一个可以轻松使导航栏透明的UINavigationBar类别
描述
UINavigationBar-TransparentNavBar是一个类别,允许您将UINavigationBar的背景设置为透明或您选择的任何UIColor。
因为它是一个UINavigationBar类别,所以每次将UIViewController推入或从导航层次结构弹出时都可以更改UINavigationBar的背景。
如何安装
将此添加到您的CocoaPods Podfile中。
pod 'UINavigationBar-Transparent'
如何使用
在您的UIViewController中
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationItem.title = "Transparent Nav Bar"
self.navigationController?.navigationBar.setBarColor(UIColor.clear)
}
享受我的其他库吧 :)
在键盘显示时保持视图可见的优雅解决方案 https://github.com/IdleHandsApps/IHKeyboardAvoiding
居中且可重用的按钮样式,并连接到InterfaceBuilder https://github.com/IdleHandsApps/DesignableButton
自动显示无网络连接提示的完整状态栏覆盖 https://github.com/IdleHandsApps/StatusBarOverlay
作者
- Fraser Scott-Morrison ([email protected])
许可证
基于MIT许可证分发