项目简介
一个自定义UINavigationController,能够实现导航栏随查看内容滚动而滚动。
Versioning notes
Version2.x作为一个UINavigationController 子类编写,开题报告,使用Swift。
Version2.0.0引入了Swift2.0语法。版本3.0.0引入了Swift2.0语法。
Screenshot
使用CocoaPods安装pod 'AMScrollingNavbar'
use_frameworks!
使用Carthage安装github "andreamazz/AMScrollingNavbar"
使用方法
确保在UINavigationController中使用ScrollingNavigationController的子类。无论是在Storyboard中设置UINavigationController类,还是在代码以编程的方式创建一个ScrollingNavigationController实例。使用followScrollView(_: delay:) 来启动滚动视图的跟随滚动。
Swift
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated) if let navigationController = navigationController as? ScrollingNavigationController { navigationController.followScrollView(tableView, delay: 50.0) }}
Objective-C
(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated]; [(ScrollingNavigationController *)self.navigationController followScrollView:self.tableView delay:50.0f];}
使用stopFollowingScrollview()来关闭这个行为。
override func viewDidDisappear(animated: Bool) {
super.viewDidDisappear(animated) if let navigationController = navigationController as? ScrollingNavigationController { navigationController.stopFollowingScrollView() }}
github地址:https://github.com/andreamazz/AMScrollingNavbar
,开题报告