'NavigationDropdown', a lightweight and elegant in Swift
To create a NavigationDropdown
from UINavigationBar
NavigationDropdown
works by showing a child UIViewController
as a dropdown from a NavigationTitleButton
. The most common use case is to show from a UINavigationController
, in that sense, you can just create a list of items, and provide to NavigationTitleButton
.
let items = ["World", "Sports", "Culture", "Business", "Travel"]
let titleView = NavigationTitleButton(with: self, items: items, selectedItem: nil)
titleView?.itemSelectionHandler = { [weak self] index in
print("select \(index)")
}
navigationItem.titleView = titleView
You can also customize many aspects of NavigationDropdown
via Config
Config.List.DefaultCell.Text.color = .red
NavigationDropdown is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'NavigationDropdown'
NavigationDropdown is also available through Carthage. To install just write into your Cartfile:
github "salientsys/navigation-dropdown-ios"
NavigationDropdown can also be installed manually. Just download and drop Sources
and Resources
folders in your project.
- Salient Systems Corporation, mobile.salientsys@gmai.com
We would love you to contribute to NavigationDropdown, check the CONTRIBUTING file for more info.
NavigationDropdown is available under the MIT license. See the LICENSE file for more info.