[英]How to change center tab bar button colour in iOS 7?
I want the middle button in my UITabBarController
to have a different colour to the others, like Instagram for example. 我希望UITabBarController
的中间按钮具有与其他按钮不同的颜色,例如Instagram。 Does anyone have any suggestions? 有没有人有什么建议?
Instead of colour you should set every tabBarItem
image differently for each one (If you want it just like instagram) 您应该为每个tabBarItem
图像设置不同的颜色(而不是颜色)(如果您希望像instagram一样)
Here is an example for one: 这是一个示例:
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];
Hope this helps :) 希望这可以帮助 :)
Cheers 干杯
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.