项目作者: BhaveshSarwar

项目描述 :
Navigation bar with customize height
高级语言: Swift
项目地址: git://github.com/BhaveshSarwar/CustomNavigationBar.git
创建时间: 2018-03-06T16:37:32Z
项目社区:https://github.com/BhaveshSarwar/CustomNavigationBar

开源协议:

下载


CustomNavigationBar

Navigation bar with customize height

This can help to customise the height of navigation bar
Navigation bar provides default back button and title

There are two types to use custom navigation bar

  1. Global navigation bar
    Global navigation bar is configured from the appdelegate. it will work same throughout the app
    you dont need to add navigation bar in every view controller. once it has been configured it will be steady throughout the app

    To use this You have to follow steps

    • Enable navigation bar from the AppDelegate

    AppDelegate.swift

    1. CustomNavigationBar.enableGlobalCustomNavigationBar(forWindow: self.window!, customHeight: 80)

    ViewController.swift

    • Update contents of navigation bar in each viewcontroller so navigation bar will be steady but the contents can be reconfigured
      there will not be any kind of redraw and animation in Navigation bar

      //WITHOUT CUSTOMISE BACK BUTTON (it will use default back button)
      let window :UIWindow = UIApplication.shared.keyWindow!
      window.customNavigationBar()?.setNavigationBarItems(title: “Title”,

      1. isCustomBackButton: false,
      2. rightBarButtonsCustomView: NSArray())
  1. //User can provide custom back button with
  2. //CUSTOM BACK BUTTON
  3. window.customNavigationBar()?.setNavigationBarItems(title: "Title",
  4. isCustomBackButton: true,
  5. rightBarButtonsCustomView: NSArray(),
  6. backButton:customBackbutton)
  1. Local Navigation bar
    This navigation bar needs to be configured in each view controller. in this type of navigation bar will be tightly coupled to the viewController’s view
    so this can also have push effect or any transition effect which are given to the view controller. This will also have same type with custom back button or without custom back button

    1. //WITHOUT CUSTOMISE BACK BUTTON (it will use default back button)
    2. let navigationBar = CustomNavigationBar.addCustomNavigationBarOnView(viewToAdd: self.view,
    3. navigationaBarTitle: "Title",
    4. isCustomBackButton: false,
    5. rightBarButtons: NSArray(),
    6. customHeight: navigationBarHeight)
    7. //User can provide custom back button with
    8. //CUSTOM BACK BUTTON
    9. //Initializing custom navigation bar
    10. let navigationBar = CustomNavigationBar.addCustomNavigationBarOnView(viewToAdd: self.view,
    11. navigationaBarTitle: "Title",
    12. backButton: btnLeftMenu,
    13. isCustomBackButton: true,
    14. rightBarButtons: NSArray(),
    15. customHeight: navigationBarHeight)

    EXTRA FEATURES

    1. - Navigation bar having custom shadow
    2. navigationBar.dropShadow()