我希望UITabBarController
中的中间按钮与其他按钮颜色不同,例如Instagram。有没有人有任何建议?
答案 0 :(得分:1)
您应该为每个tabBarItem
图像设置不同的颜色而不是颜色(如果您希望它像Instagram一样)
以下是一个示例:
UITabBarItem *tabBarItem = [yourTabBarController.tabBar.items objectAtIndex:2]; //set objectAtIndex you want (For Instagram its 2)
UIImage *unselectedImage = [UIImage imageNamed:@"unselected-imagename"]; //set unselected image
UIImage *selectedImage = [UIImage imageNamed:@"selected-imagename"]; //set selected image
[tabBarItem setImage: [unselectedImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
[tabBarItem setSelectedImage: selectedImage];
希望这会有所帮助:)
干杯