iOS中设置导航栏的背景颜色和标题字体以及颜色,以及tabBarItem的图片和字体颜色的设置
来源:互联网 发布:stc89c52rc数据手册 编辑:程序博客网 时间:2024/05/16 18:23
翻了一下以前的博客,发现之前没有记录这一知识点,庆祝中华人民共和国抗战胜利暨反法西斯胜利70周年阅兵放假三天(中国威武,犯我中华者,虽远必诛),假期在家用Swift研究微信的时候突然想到这个东西,就把代码粘一下吧,当然这里粘的是OC的代码,Swift的代码在家里自己电脑上,其实方法的关键字都差不多,就是OC与Swift语法不太一样而已。
//设置导航栏的背景颜色和标题字体以及颜色
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{if ([UIDevice currentDevice].systemVersion.floatValue >= 7.0) { [[UINavigationBar appearance] setBarTintColor:[UIColor orangeColor]]; [[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:[UIColor redColor], NSForegroundColorAttributeName, [UIFont fontWithName:@ "HelveticaNeue-CondensedBlack" size:21.0], NSFontAttributeName, nil]]; }}
//设置tabBarItem的图片和字体颜色的
//设置tabBarItem未选中状态和选中状态下的图片, UIImage *settingsImg = [UIImage imageNamed:@"设置当前icon"]; settingsImg = [settingsImg imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];//原图片显示,不失真,不会变成系统默认蓝色 [_settingsVC.tabBarItem setFinishedSelectedImage:settingsImg withFinishedUnselectedImage:[UIImage imageNamed:@"设置icon"]]; [self unSelectedTapTabBarItems:_settingsVC.tabBarItem]; [self selectedTapTabBarItems:_settingsVC.tabBarItem];//设置tabBarItem没选中时的字体自颜色-(void)unSelectedTapTabBarItems:(UITabBarItem *)tabBarItem{ [tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIFont systemFontOfSize:14], UITextAttributeFont,[UIColor grayColor],UITextAttributeTextColor, nil] forState:UIControlStateNormal];}//设置tabBarItem选中时的字体颜色-(void)selectedTapTabBarItems:(UITabBarItem *)tabBarItem{ [tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIFont systemFontOfSize:14], UITextAttributeFont,[UIColor redColor],UITextAttributeTextColor, nil] forState:UIControlStateSelected];}
0 0
- iOS中设置导航栏的背景颜色和标题字体以及颜色,以及tabBarItem的图片和字体颜色的设置
- 设置tabBarItem字体颜色和图片颜色
- tabbaritem的字体颜色设置
- iOS导航栏NavigationBar的颜色,按钮和标题以及字体颜色
- IOS设置全局的导航图片和字体颜色
- 设置导航栏的背景颜色和字体
- iOS中设置导航栏标题的字体颜色和大小
- iOS中设置导航栏标题的字体颜色和大小
- iOS中设置导航栏标题的字体颜色和大小
- iOS中设置导航栏标题的字体颜色和大小
- iOS中设置导航栏标题( titleView)的字体颜色和大小
- iOS中设置导航栏标题的字体颜色和大小
- 修改iOS导航栏标题的字体颜色和大小以及导航栏的背景图片
- gVim的字体和背景颜色设置
- 设置RGui的背景颜色和字体
- 设置Dialog的背景颜色及其中控件的背景颜色和字体颜色
- shell进度条以及shell中背景和字体颜色的设置
- iOS设置导航栏颜色以及状态栏字体颜色
- hdu 1237 简单计算器(数组模拟栈,队列)
- python中json到dict转换
- 【学习总结】总结一些书籍、Blog、网站等资料汇总
- mysql prepareStatement executeQuery() 内存溢出的解决办法
- 输出9*9口诀。共9行9列,i控制行,j控制列。
- iOS中设置导航栏的背景颜色和标题字体以及颜色,以及tabBarItem的图片和字体颜色的设置
- PHP基本数据类型
- poi导出中文名出现乱码或者不出现的的情况
- 投影曲线的波峰查找
- 该入门教程的流程是这样的
- 双向链表
- unicode编码转换成汉字
- TNS-04612 error
- java中GBK编码格式转成UTF8