【发布时间】:2023-04-05 03:41:01
【问题描述】:
我想根据标签栏的选定索引更改 tintColor 属性。我现在使用的代码不起作用,所有的标签栏视图都有这个代码:
- (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;
}
}
【问题讨论】: