使用故事板ios7在标签栏控制器中设置选定的图像

时间:2014-07-04 12:46:05

标签: ios storyboard uitabbarcontroller

我正在使用Storyboarding,我有一个带有3个标签的标签栏控制器。我可以设置标签栏项目的图像。 我无法弄清楚如何使用故事板来做到这一点。

1 个答案:

答案 0 :(得分:1)

UITabBar *tabBar = self.tabBar;

UITabBarItem *targetTabBarItem = [[tabbar items] objectAtIndex:0]; // whichever tab-item
UIImage *selectedIcon = [UIImage imageNamed:@"name-of-selected-image.png"];
[targetTabBarItem setSelectedImage:selectedIcon];