在iOS8系统下,UITabbar上的item自定义背景色和图片问题
2014-11-04 10:15
344 查看
解决方法:
//选择的图片
UITabBar *tabBar = self.tabBar;
UITabBarItem *tabBarItem1 = [tabBar.items objectAtIndex:0];
UITabBarItem *tabBarItem2 = [tabBar.items objectAtIndex:1];
UITabBarItem *tabBarItem3 = [tabBar.items objectAtIndex:2];
tabBarItem1.title = @"title1";
tabBarItem2.title = @"title2";
UIImage* selectedImage = [UIImage imageNamed:@"xxxx.png"];
UIImage* unselectedImage = [UIImage imageBunded:unselImgName];
//声明这张图片用原图(别渲染)
selectedImage = [selectedImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
unselectedImage = [unselectedImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
[tabBarItem1 setFinishedSelectedImage:selectedImage withFinishedUnselectedImage:unselectedImage ];
[tabBarItem2 setFinishedSelectedImageselectedImage withFinishedUnselectedImage:unselectedImage];
//选择的图片
UITabBar *tabBar = self.tabBar;
UITabBarItem *tabBarItem1 = [tabBar.items objectAtIndex:0];
UITabBarItem *tabBarItem2 = [tabBar.items objectAtIndex:1];
UITabBarItem *tabBarItem3 = [tabBar.items objectAtIndex:2];
tabBarItem1.title = @"title1";
tabBarItem2.title = @"title2";
UIImage* selectedImage = [UIImage imageNamed:@"xxxx.png"];
UIImage* unselectedImage = [UIImage imageBunded:unselImgName];
//声明这张图片用原图(别渲染)
selectedImage = [selectedImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
unselectedImage = [unselectedImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
[tabBarItem1 setFinishedSelectedImage:selectedImage withFinishedUnselectedImage:unselectedImage ];
[tabBarItem2 setFinishedSelectedImageselectedImage withFinishedUnselectedImage:unselectedImage];
相关文章推荐
- 在iOS8系统下,UITabbar上的item自定义背景色和图片问题
- 在iOS8系统下,UITabbar上的item自定义背景色和图片问题 (
- 在iOS8系统下,UITabbar上的item自定义背景色和图片问题
- 在iOS8系统下,UITabbar上的item自定义背景色和图片问题
- 解决iOS8以上系统下app底部UITabBarItem上自定义的背景色和图片,在首次启动或push之后再pop回去会变成系统默认颜色-蓝色问题
- 使用系统UITabbarItem自定义图片显示原本颜色和自定义文字颜色
- 给系统的UITabbarViewController 的tabBarItem 添加图片的问题
- 关于标签栏(UITabBarItem)的系统颜色和图片以及标题颜色的问题
- xcode6.1 自定义tabbar与poptoview产生重叠问题以及ios8上自定义tabbar图片显示颜色是系统颜色问题
- iOS8 自定义UITabBar (使用popToViewController导致的UITabBarButton重叠的问题)
- 项目里出现的问题 01(声明这张图片用原图 别渲染) (随机颜色) (自定义Log) (查找当前ios系统版本是多少)
- ios8中最新自定义UITabbar上的字体颜色和图片的方法
- iOS开发- UITabBarItem自定义图片(去除灰色)
- iOS开发- UITabBarItem自定义图片(去除灰色)
- iOS开发- UITabBarItem自定义图片
- ios之UITabBarItem显示真实自定义的图片而非颜色填充
- iOS8 自定义navigationbar 以及 UIBarButtonItem 边距问题
- DedeCMS系统自定义字段图片类型调用的路径问题解决办法.doc
- iOS7修改UITabBar文本颜色以及解决自定义选中图片显示为默认蓝色的问题
- ListView item中的 RadioButton(自定义RadioButton图标,默认无图,选择有图)点击时不显示图片问题