ios更改UITabBarController背景以及选中背景图片的方法
一、背景图片
1、5.0以上版本
UIImage *image = [UIImage imageNamed:@'system_tabbar_bg.png'];
[self.tabBar setBackgroundImage:image];
2、5.0以下版本
UIImage *image = [UIImage imageNamed:@'system_tabbar_bg.png'];
NSArray *array = [self.view subviews];
UITabBar *tabBar = [array objectAtIndex:1];
tabBar.layer.contents = (id)image.CGImage;
二、选中的item的背景图片设置
1、5.0以上版本
self.tabBar.selectionIndicatorImage = [UIImage imageNamed:@'system_tabbar_item_selected.png'];
2、5.0以下版本
首先实现如下方法:
- (void)setNoHighlistTabBar:(UITabBarController *)tabBarController
{
NSArray * tabBarSubviews
本文详细介绍了如何在iOS中为UITabBarController自定义背景图片及选中状态下的背景图片。适用于不同版本的iOS系统,包括5.0及以上版本和5.0以下版本。
8014

被折叠的 条评论
为什么被折叠?



