UINavigationBar.appearance(); //在早期版本上设置 不能全局的方式设置 会导致app崩溃 //appear.translucent = false; //设置bar的颜色 appear.barTintColor = UIColor(red: 52/255, green: 146/255, blue: 233/255, alpha: 1.0); //设置背景色(不透明时没用,因为barTintColor在backgroundColor ; 注意 1) appear.translucent配置在早期系统会崩溃,不建议配置,建议在ViewController中配置 2) 在translucent=true也就是透明时,barTintColor 不起作用,backgroundColor起作用 3) 在translucent=false也就是不透明时,barTintColor起作用,backgroundColor不起作用 4) 在translucent
UINavigationBar.appearance(); //设置Item的样式 appear.tintColor = UIColor.whiteColor(); //设置bar的颜色 appear.barTintColor = UIColor(red: 39/255, green: 157/255, blue: 244/255, alpha: 1.0); //设置背景色(不透明时没用,因为barTintColor在backgroundColor UINavigationBar *appear = [UINavigationBar appearance]; appear.tintColor = [UIColor clearColor]; appear.barTintColor searchBarAppear.backgroundColor = UIColor.clearColor(); searchBarAppear.tintColor = ZJ_Color.天空蓝; searchBarAppear.barTintColor
Text> </Icon.Button> <TabBarIOS //和标签视图一起使用 tintColor="#4977f0" barTintColor NavigatorIOS //导航栏 style={styles.container} tintColor='#FFFFFF' barTintColor <NavigatorIOS style={styles.container} tintColor='#FFFFFF' barTintColor
--more--> 修改 设置方法需修改,参考barTintColor not working in iOS 15 原来设置导航栏代码不变,新增设置UINavigationBarAppearance实例对象的属性 参考 How to hide UINavigationBar 1px bottom line navigationBar setBackgroundImage not working on iOS15 barTintColor
= UIImagePickerControllerSourceType.photoLibrary 22 23 self.imagePickerController.navigationBar.barTintColor self 26 self.imagePickerController.allowsEditing = true 27 self.imagePickerController.navigationBar.barTintColor
特殊情况(暗色系导航栏) 如果项目中有更改系统导航栏背景色,比如下面代码: self.navigationController.navigationBar.barTintColor = [UIColor blackColor]; //barTintColor 设置时,系统会自动把导航栏设置为半透明,若不想要半透明效果,需要设置 translucent 为 NO self.navigationController.navigationBar.translucent
globalBarTintColor是我自定义的浅海蓝色,后面还会出现) self.tabBar.tintColor = UIColor.whiteColor() self.tabBar.barTintColor titleTextAttributes = [NSForegroundColorAttributeName:UIColor.whiteColor()] UINavigationBar.appearance().barTintColor
TabBarIOS 常见属性 继承了View的所有属性 barTintColor:标签栏的背景颜色 tintColor:当前被选中的标签图标颜色 translucent:bool值,决定标签栏是否需要半透明化 角标 <TabBarIOS style={{height:49, width: width}} tintColor="green" barTintColor="black style={{height:49, width: width}} tintColor="green" barTintColor
设置代码如下: 获取导航栏的背景图,用于滚动时修改颜色和透明图 设置barTintColor为蓝色 设置barTintColor为白色 barImg = (navigationController?. navigationBar.barTintColor = UIColor.rgb(63, 141, 208) navigationController?.
self.pickerViewController.navigationBar.barStyle = UIBarStyleBlackTranslucent; self.pickerViewController.navigationBar.barTintColor self.pickerViewController.navigationBar.barStyle = UIBarStyleBlackTranslucent; self.pickerViewController.navigationBar.barTintColor
appear.translucent = false; //设置Item的样式 appear.tintColor = UIColor.whiteColor(); //设置bar的颜色 appear.barTintColor = UIColor(red: 52/255, green: 146/255, blue: 233/255, alpha: 1.0); //设置背景色(不透明时没用,因为barTintColor在backgroundColor searchBarAppear.backgroundColor = UIColor(red: 240/255, green: 240/255, blue: 240/255, alpha: 1.0); searchBarAppear.barTintColor
preferredStatusBarStyle { returnUIStatusBarStyleLightContent; } //改动navigationBar的颜色 self.navigationBar.barTintColor
self.navigationController.navigationBar.barStyle = UIBarStyleBlack; self.navigationController.navigationBar.barTintColor
手动设置背景色及标题 UINavigationBar *navBar = [UINavigationBar appearance]; navBar.barTintColor = [UIColor
appear.isTranslucent = false; //设置Item的样式 appear.tintColor = UIColor.white; //设置bar的颜色 appear.barTintColor = ZJColor.mainColor; //设置背景色(不透明时没用,因为barTintColor在backgroundColor的上一层) appear.backgroundColor
@property(nullable, nonatomic,strong) UIColor *barTintColor; BarTintColor用于设置导航栏的背景色,这个属性被设置后,半透明的效果将失效
barTintColor = UIColor.clear if let textfiled = searchBar?.subviews.first?.
上面仅作演示,下面的代码为searchBar的主要设置 let commonBgColor = RGBA(r: 0.94, g: 0.94, b: 0.96, a: 1.00) searchBar.barTintColor
null_resettable, nonatomic,strong) UIColor *tintColor; //设置工具栏背景色 @property(nullable, nonatomic,strong) UIColor *barTintColor
TabBarIOS 常用属性 barTintColor string:标签栏的背景颜色。 style:样式 tintColor string: 当前被选中的标签图标的颜色。 直接创建一个TabBarIOS组件: render() { return ( <TabBarIOS tintColor='orange' barTintColor Tab的代码就应该是这样: render() { return ( <TabBarIOS tintColor='orange' barTintColor