tabBar与状态栏
来源:互联网 发布:ubuntu golang 1.8 编辑:程序博客网 时间:2024/06/06 21:44
一些基本的statusBar与NavigationBar的使用
1. 修改回退按钮的颜色:
storyboard:可以上要回退到即显示回退按钮页面的前一个页面设置,如果是storyboard,选择navigationBar,在Interface Builder Document中找到Global Tint修改成自己想要的颜色即可。
代码:
[self.navigationController.navigationBar setTintColor: [UIColor yellowColor]];
可参考:
http://www.2cto.com/kf/201403/285887.html
2. 如果直接取tabBar的tintColor,发现贴出来后不一样,原因可能是其设置颜色设置了translucent(半透明),默认是选中,的,如果选中后,则会出现颜色搭配经过了透明化,而且保证了下面视图的view尺寸不变,如果取消了这个效果,就会导致view的实际视图身下偏移。
可参考:
http://www.cocoachina.com/bbs/read.php?tid=280826
3.在tabBar上如果我们实现了图片的渲染那么自己定义的一些如果有颜色的图片就会被默认的蓝色所取代,所以我们有时是需要将渲染的效果去掉才好。 storyboard上是不可以直接通过调整属性设置图片显示渲染效果,只能通过代码实现: 实现图片不添加渲染有两种效果,一种是通过代码如下
UIImage *image = [UIImage imageNamed:@"home"]; image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; UITabBarItem *item = [[UITabBarItem alloc] initWithTitle:@"首页" image:image tag:1]; self.tabBarItem = item; // 设置图片没有经过渲染 self.tabBarController.tabBar.tintColor = [UIColor redColor]; // 设置选中的文字效果及图片颜色(如果图片有经过渲染的话)
二、通过storyboard 实现:
- 需要将图片放到一个.xcassets中才可以使用【前提】
- 在***.xcassets中选中图片
- 在右侧选择attributes inspector
- 在快到下面有一个选项为Render As Default
- 只需要将Default改为Original Image即为不需要渲染。
4. 如果想实现将tabBar中Item的文字颜色改变有两种方法:
一: 代码实现,如果想实现全局颜色改变可以在**appdelegate.h中didFinishLaunch 中添加如下(想局部就需要自己在控制器所使用的Item中设置)
[[UITabBarItem appearance] setTitleTextAttributes:@{ NSForegroundColorAttributeName:[UIColor lightGrayColor]} forState:UIControlStateNormal]; [[UITabBarItem appearance] setTitleTextAttributes:@{ NSForegroundColorAttributeName:[UIColor orangeColor]} forState:UIControlStateSelected];
二: storyboard实现
- 在storyboard中找到tabBarViewController中找到的自己的tabBar
- 在identify inspector中找到User Defined Runtime Attributes(点击框框左下角的加号新加一个属性值)
- 添加如下:
- 设置如下:
keyPath TypeValueselectedImageTintColor Color 【你需要的颜色】
0 0
- tabBar与状态栏
- 状态栏高度改变 tabbar高度问题
- iOS状态栏 导航条 tabbar高度
- Tabbar与Navigation嵌套
- 状态栏高度 navigationBar高度 tabbar高度
- 状态栏 导航栏 tabbar背景色&字体颜色设置
- iOS7设置状态栏与状态栏
- tabBar隐藏与显现 hidesBottomBarWhenPushed
- IOS-自定义Tabbar与Navigation
- app启动页与tabbar
- 【swift】显示与隐藏tabBar
- tabbar!
- tabBar
- tabBar
- tabbar
- tabBar
- 工具栏与状态栏
- 工具栏与状态栏
- [Java学习] Java插入排序实现
- Oracle temp表空间爆满的处理方法
- H5活动页面遇到的坑+微信分享代码
- ps 修改图片大小(分辨率)(png图片)
- android 5.0 API新增特点和改进
- tabBar与状态栏
- String
- 欢迎使用CSDN-markdown编辑器
- QT5.5+VS2010配置心得
- android获取屏幕尺寸、密度(判断手机屏幕类型)
- LeetCode训练:strstr
- Ios Layer Transform 形变
- POJ 3190 Stall Reservations 【贪心 区间】
- 点滴