您的位置:首页 > 移动开发 > IOS开发

iOS设置图片名称、启动图片、防止TabBar图片和文字渲染

2017-02-08 11:00 393 查看

设置App的名称



设置App的启动图片




需要注意点是,App要杀掉重启才能显示出启动图片


2种方法防止图片被渲染

1.

vc02.tabBarItem.image=[UIImageimageNamed:@"tabBar_new_icon"];
UIImage*image=[UIImageimageNamed:@"tabBar_new_click_icon"];
image=[imageimageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
vc02.tabBarItem.selectedImage=image;

2.



文字被渲染解决方法

1.

vc02.tabBarItem.title=@"新帖";
NSMutableDictionary*attrs=[NSMutableDictionarydictionary];
attrs[NSForegroundColorAttributeName]=[UIColorgrayColor];
[vc02.tabBarItemsetTitleTextAttributes:attrsforState:UIControlStateNormal];
NSMutableDictionary*attrs1=[NSMutableDictionarydictionary];
attrs1[NSForegroundColorAttributeName]=[UIColorblackColor];
[vc02.tabBarItemsetTitleTextAttributes:attrs1forState:UIControlStateSelected];

2.



通过appearance统一设置所有UITabBarItem的文字属性

后面带有UI_APPEARANCE_SELECTOR的方法,都可以通过appearance对象来统一设置


NSMutableDictionary*dic=[NSMutableDictionarydictionary];
dic[NSForegroundColorAttributeName]=[UIColorgrayColor];

NSMutableDictionary*selectedDic=[NSMutableDictionarydictionary];
selectedDic[NSForegroundColorAttributeName]=[UIColordarkGrayColor];

UITabBarItem*item=[UITabBarItemappearance];
[itemsetTitleTextAttributes:dicforState:UIControlStateNormal];
[itemsetTitleTextAttributes:selectedDicforState:UIControlStateSelected];


                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐
章节导航