中文介绍
YRNavigationBarPure所有 UIViewControllers 都使用与 UINavigationController 的子控制器相同的 UINavigationBar。 UIViewController 的设置决定了当推送或弹出时 UINavigationBar 的过渡效果。当一个 UIViewController 将 uinavigationbar 设置为隐藏,有时这种过渡效果就不是很友好。
YRNavigationBarPure 通过 sendSubviewToBack:
隐藏 UINavigationBar,并为每个 UIViewController 生成一个 UINavigationbar 的截图。当发生推送或弹出时,该截图被添加到 UIViewController 的视图中,所以每个 UIViewcontroller 看起来都有一个独立的 UINavigationBar。
屏幕截图
原始
现在
使用
为 UIViewController 添加了两个扩展属性。您需要完成 viewDidLoad
中的导航栏设置。您只需要关注当前 UIViewController 的导航栏样式,无需担心恢复设置。YRNavigationBarPure
将管理这一切。
yr_prefersNavigationBarHidden
默认值为 NO
。如果您的 UIViewController 需要隐藏导航栏,请将该属性设为 YES
。
self.yr_prefersNavigationBarHidden = YES;
yr_interactivePopDisabled
默认值为 NO
。如果您的 UIViewController 需要禁用侧滑,请将该属性设为 YES
。
self.yr_interactivePopDisabled = YES;
UINavigationController 有一个扩展属性
yr_allowFullScreenInteractivePop
默认值为 NO
,如果您需要启用全屏滑动后退,请将其设置为 YES
。
self.yr_allowFullScreenInteractivePop = YES;
安装
要使用 CocoaPods 将 YRNavigationBarPure 的最新版本集成到您的 Xcode 项目中,在 Podfile 中指定它
pod 'YRNavigationBarPure'
然后运行指令
$ pod install
需求
- iOS 9.0
许可
YRNavigationBarPure 采用 MIT 许可协议发布。有关详细信息,请参阅 LICENSE。