YKNavigationController 是基于 JTNavigationController 封装的自定义 NavigationController。
使用
[self.navigationController setNavigationBarHidden:YES animated:NO];
方法来隐藏导航栏会导致滑动返回手势无效使用
self.navigationController.navigationBar.hidden = YES;
方法来隐藏导航栏会导致返回到带导航栏页面过程中导航栏被切掉的效果。
导航栏和页面 View 作为整体滑动,避免了一些隐藏了导航条无法使用返回手势,或者隐藏导航条后返回到带导航条页面过程中出现导航栏被剪切掉的效果。
相比于 JTNavigationController,进行了以下修改:
YKNavigationController 继承自 UINavigationController,大小项目均可以使用。
YKNavigationController 支持 iOS7 或之后的版本。
只需将原来的 UINavigationController
替换为 YKNavigationController
即可.
修改 UINavigationController
的 class 为 YKNavigationController
self.navigationController
的方法即可,popToViewController
有所不同,详情见 Demo 中的代码preferredStatusBarStyle
或者 [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]
(需要在 info 文件中加入 View controller-based status bar appearance = NO)backButtonImage
属性barTintColor
,增加 barButtonItem
等,导航栏的操作都可以放到 viewDidLoad 中,因为每个控制器都有自己的 UINavigationController
,所以不会影响到其他控制器的导航栏YKNavigationController 是基于 JTNavigationController 进行的开发,感谢他对开源社区做出的贡献。
YKNavigationController 在 MIT 协议下使用。查阅 LICENSE 文件以获得更多信息。