设置 UINavigationBar 全局颜色,背景颜色,前景颜色 swift 3 4 ios 10 +
2017-11-01 01:06
323 查看
全局设置
写在 AppDelegate 中的func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool方法中
UINavigationBar.appearance().tintColor = Colors.orange //前景色,按钮颜色 UINavigationBar.appearance().barTintColor = Colors.orange //背景色,导航条背景色 UINavigationBar.appearance().isTranslucent = true // 导航条背景是否透明 UINavigationBar.appearance().titleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor.white] // 设置导航条标题颜色,还可以设置其它文字属性,只需要在里面添加对应的属性
非全局设置
写在相应的 ViewController 中即可navigationController?.navigationBar.tintColor = UIColor.orange //前景色,按钮颜色 navigationController?.navigationBar.barTintColor = UIColor.white //背景色,导航条背景色 navigationController?.navigationBar.isTranslucent = true // 导航条背景是否透明 navigationController?.navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor.white] // 设置导航条标题颜色,还可以设置其它文字属性,只需要在里面添加对应的属性
想让图标显示原始颜色请看这里: http://blog.csdn.net/kimbing/article/details/78409733
相关文章推荐
- ios 更改全局UINavigationBar的背景图片以及通知栏颜色
- iOS swift设置导航栏(navigationBar)背景颜色,标题颜色和字体大小,item颜色
- ios状态栏颜色的设置(背景、前景)
- IOS设置导航栏全局的背景图片、导航栏title文字颜色大小、导航栏左右按钮的颜色。
- iOS设置UINavigationBar的背景颜色或背景图片
- iOS设置UINavigationBar的背景颜色或背景图片
- Ios开发Swift自定义UIbutton增加一个能设置高亮状态下背景颜色的方法
- iOS开发之设置navigationBar的背景颜色为无色
- IOS UINavigationBar 背景及按钮颜色设置
- iOS 设置自带UISearchBar的背景颜色
- iOS中设置导航栏的背景颜色和标题字体以及颜色,以及tabBarItem的图片和字体颜色的设置
- iOS_自定义view里的按钮点击不了+背景颜色也设置不了
- iOS中通过设置CSS改变WebView字体大小,颜色,背景颜色
- ios自定义导航navigation,设置navigation的背景图,navigation左边按钮,以及navigation字体颜色
- ios 修改navigationBar背景颜色swift版
- 设置uinavigationbar的背景颜色
- ios设置导航栏的背景颜色或背景图片
- ios tableview和cell背景颜色设置
- iOS 8 设置导航栏的背景颜色和背景图片
- iOS-如何设置按钮高亮的背景颜色