ios8中UITabbarController的图片颜色处理
来源:互联网 发布:脉脉软件安全吗 编辑:程序博客网 时间:2024/05/03 17:30
<strong>我们知道。在IOS8中,对于UITabbarController的方法,有些已经不能用了,下面把最新的方法介绍如下:</strong>
1.
用下面的代码,可以对tabbaritem进行图片设定,即没有点击和点击之后的图片分别显示如何:
UIImage * normalImage = [[UIImage imageNamed:@"abbbab"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; UIImage * selectImage = [[UIImage imageNamed:@"aaaaaaaaSelected"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; UITabBarItem * tabBarItemlala = [[UITabBarItem alloc]initWithTitle:@"haha" image:normalImage selectedImage:selectImage]; self.tabBarItem = tabBarItemlala;2.
用下面的代码,可以对字体的颜色进行设定成自己想要的颜色。
[self.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor greenColor], NSForegroundColorAttributeName, nil] forState:UIControlStateNormal]; [self.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor redColor], NSForegroundColorAttributeName, nil] forState:UIControlStateSelected];上面两个功能的截图如下:
他们的点击和未点击情况下的两种形式
3.
将所有的图片和文字在选中的时候变成自己设定的颜色
[self.tabBarController.tabBar setTintColor:[UIColor redColor]];如图:
4.背景色的修改:
UIView *bgView = [[UIView alloc] initWithFrame:self.tabBarController.tabBar.bounds]; bgView.backgroundColor = [UIColor redColor]; [self.tabBarController.tabBar insertSubview:bgView atIndex:1]; self.tabBarController.tabBar.opaque = YES;这里注意atIndex:1。这里是1哦,不是0,也不是2.大家可以把1换成其他的看看效果。
下面的截图:
0 0
- ios8中UITabbarController的图片颜色处理
- iOS开发 在storyboard中拖的UITabBarController,设置选中时的图片和字体颜色
- ios8中最新自定义UITabbar上的字体颜色和图片的方法
- 改变UITabBarController的颜色
- 改变UITabBarController的颜色
- UITabBarController设置选中时图片和文字的颜色
- 图片的颜色处理
- UITabbarController更改点击的图片与文字颜色以及更改tabbar的视图颜色
- iOS8中UIBarButtonItem的setTitleTextAttributes对Disabled颜色设置无效
- UITabBarController、TabBar背景颜色设置、TabBarItem颜色处理
- iOS 系统自带UITabBarController 字体颜色以及图片的控制
- 设置UITabBarController的图片问题
- 如何改变UITabBarController中tabBar和UINavigationController中navigationBarr的颜色
- 图片的圆角和颜色处理
- Android之图片的颜色处理
- Swift中UITabBarController图片去除渲染
- 修改UITabBarController字体颜色 图片大小颜色的小问题
- j2me图片颜色处理
- Linux进程优先级调整
- 优秀 android 开发网站荟萃
- 刀子嘴玻璃心的董明珠,何尝不需要另一个小米?
- 机器学习资源总结
- hadoop-2.6.0集群环境搭建
- ios8中UITabbarController的图片颜色处理
- ubuntu下的jdk安装
- 包含双重指针的结构体指针的分配内存与释放内存
- Search Insert Position
- android AsyncTask介绍
- 对只含1、2、3的数组排序
- div+css初步探索(2)
- 九度OJ 1183 守形数 (模拟)
- js代码整理