0
我想根据tabbar的选定索引更改tintColor属性。我现在使用的代码不起作用,所有tabbar视图都有此代码:如何根据TabBar选择的索引设置色调颜色?
- (void)viewDidAppear:(BOOL)animated{
switch (self.tabBarController.selectedIndex) {
case 0:
self.tabBarController.tintColor = [UIColor colorWithRed:147/255 green:22/255 blue:0/255 alpha:1.0];
break;
case 1:
self.tabBarController.tintColor = [UIColor whiteColor];
break;
case 2:
self.tabBarController.tintColor = [UIColor greenColor];
break;
default:
break;
}
}
这就是我的回答? :-)适当的给我一些信用。 – Unheilig
@Unheilig保持冷静,我不会... –