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

设置App的名称

设置App的启动图片

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

2种方法防止图片被渲染

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

文字被渲染解决方法

vc02.tabBarItem.title = @"新帖";
NSMutableDictionary *attrs = [NSMutableDictionary dictionary];
attrs[NSForegroundColorAttributeName] = [UIColor grayColor];
[vc02.tabBarItem setTitleTextAttributes:attrs forState:UIControlStateNormal];
NSMutableDictionary *attrs1 = [NSMutableDictionary dictionary];
attrs1[NSForegroundColorAttributeName] = [UIColor blackColor];
[vc02.tabBarItem setTitleTextAttributes:attrs1 forState:UIControlStateSelected];
  • 通过appearance统一设置所有UITabBarItem的文字属性
  • 后面带有UI_APPEARANCE_SELECTOR的方法,都可以通过appearance对象来统一设置
NSMutableDictionary *dic = [NSMutableDictionary dictionary];
dic[NSForegroundColorAttributeName] = [UIColor grayColor];
    
NSMutableDictionary *selectedDic = [NSMutableDictionary dictionary];
selectedDic[NSForegroundColorAttributeName] = [UIColor darkGrayColor];
    
UITabBarItem *item = [UITabBarItem appearance];
[item setTitleTextAttributes:dic forState:UIControlStateNormal];
[item setTitleTextAttributes:selectedDic forState:UIControlStateSelected];
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 176,679评论 25 709
  • 一 、使用git管理工程 1、可以使用OSChina远程管理工程(免费) 2、可以使用GitHub网站进行远程管理...
    YuGHo阅读 7,142评论 1 3
  • 发现 关注 消息 iOS 第三方库、插件、知名博客总结 作者大灰狼的小绵羊哥哥关注 2017.06.26 09:4...
    肇东周阅读 14,753评论 4 61
  • 一大早,司机刘成师傅突然打电话给我,说临时增加一个香港男人和我一起包车去克孜尔千佛洞时,我一个人包车就是200块钱...
    法语朱老师阅读 2,586评论 0 1
  • 《心暖》 文/雪漫飞 下班回到家急急地踏进门,突感温暖,“呀,这么暖和!”吹了一路的冷风,单薄的身体被冻得哆哩哆嗦...
    雪漫飞阅读 3,047评论 13 9

友情链接更多精彩内容