iOS 5中定制Tabbar很简单,如何让选中的Tab显示不同图片

第一步:获取tabbar

1
UITabBar *tabBar = self.tabBarController.tabBar;

第二步:获取tababr的所有选项

1
UITabBarItem *item = [tabBar.items objectAtIndex:0];

第三步:设置图片,选择要设置的tabbaritem

1
2
3
4
5
NSString *homePath = [[NSBundle mainBundle] pathForResource:@"btn_home_highlight@2x" ofType:@"png"];
if(item.tag == 1)
{
item.selectedImage = [UIImage imageWithContentsOfFile:homePath];
}

这个就搞定了