iOS:关于UITabBar的一些设置

来源:互联网 发布:java properties 编辑:程序博客网 时间:2024/05/22 05:27

之前都会自定义一个UIView或者toolbar来代替UITabBar,今天终于找了一下如何很好的定义UITabBar(以下内容适用于iOS7)


1、字体颜色
[tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil] forState:UIControlStateNormal];
这个TextAttributes就是一般的NSAttribute的属性,具体设置可以百度

2、图片颜色(放上去的图片自动就变成了灰色,很恼人)
tabBarItem.image = [[UIImage imageNamed:@"bt_highlight_image.jpg"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

3、TabBar的背景颜色,这个可以直接在storyboard中设置Bar tint

4、被选中后那一块的背景图片,这个也可以在storyboard中Tab Bar中selection设置
0 0
原创粉丝点击