ADNavigationBarExtension is a UI library written in Swift. It allows you to show and hide an extension to your UINavigationBar
Use ExtensibleNavigationBarNavigationController
to set an extension under your UINavigationBar:
- The navigation controller manages the displaying of your navigation bar's extension
- It is compatible with UIAppearance
See the provided examples for help or feel free to ask directly.
ADNavigationBarExtension is written in swift 5.0. Compatible with iOS 10.0+
ADNavigationBarExtension is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'ADNavigationBarExtension'
The main component of the library is the ExtensibleNavigationBarNavigationController
.
It is basicaly a simple UINavigationController wich manages a supplementary view under the UINavigationBar.
A startup sequence might look like this:
let navigationController = ExtensibleNavigationBarNavigationController()
let navigationBarExtension = MyCustomView()
let navigationBarExtensionHeight = 64
navigationController.setNavigationBarExtensionView(navigationBarExtension, forHeight: navigationBarExtensionHeight)
navigationController.pushViewController(MyViewController(), animated: false)
window.rootViewController = navigationController
Then the ExtensibleNavigationBarNavigationController
needs to know when the navigation bar's extension needs
to be displayed or to be hidden.
You have to use the protocol ExtensibleNavigationBarInformationProvider
:
extension MyViewController: ExtensibleNavigationBarInformationProvider {
var shouldExtendNavigationBar: Bool { return true }
}
Be aware of ExtensibleNavigationBarNavigationController
is using the UINavigationControllerDelegate protocol.
So if you also need to use de navigationController's delegate proprerty, you can use this:
let navigationController = ExtensibleNavigationBarNavigationController()
navigationController.navigationControllerDelegate = self
ADNavigationBarExtension is owned and maintained by Fabernovel. You can follow us on Twitter at @FabernovelApp.
ADNavigationBarExtension is released under the MIT license. See LICENSE for details.