This project is no longer maintained. Use KMNavigationBarTransition instead.
UIViewController with its own navigation bar. It provides smooth push animations between view controllers which have different navigation bar styles.
Override hasCustomNavigationBar
method to use custom navigation bar. Then you can use navigationBar
property on UIViewController
.
class MyViewController: UIViewController {
override func hasCustomNavigationBar() -> Bool {
return true // I'm gonna use custom navigation bar!
}
}
let viewController = MyViewController()
viewController.navigationBar.barTintColor = .purpleColor() // Use custom navigation bar
viewController.navigationItem.title = "Hello" // Change navigationItem property
Note: Don't confuse with
UINavigationController
'snavigationBar
.
With UIViewController+NavigationBar, you have to do something additional to make system navigation bar hidden.
class MyViewController: UIViewController {
/// Override this method to make built-in navigation bar hidden
override func prefersNavigationBarHidden() -> Bool {
return true
}
}
I recommend you to use CocoaPods with Podfile
:
pod 'UIViewController+NavigationBar'
UIViewController+NavigationBar is under MIT license. See the LICENSE file for more info.