简体   繁体   中英

How can I change the tab bar selection color instead of blue?

Normally tab bar selection color is blue in iPhone. Instead of that I want to change the color as brown. How can I change the tabbar selection color? Shall I need to create custom tabbar controller?

In case you want to use an image:

[self.tabBar setSelectionIndicatorImage:[UIImage imageNamed:@"selected_tab.png"]];

In case you want to use a color:

[self.tabBar setSelectedImageTintColor:[UIColor whiteColor]];

是的,如果您创建了customTabBar控制器并切换了TabBar控件的背景图像,那么它的工作就像系统TabBar ...您只需创建5个不同的图像并使用TabBar Delegate方法中的选定选项卡进行设置,如果您使用图形图像,那么它也可以工作.....意味着你在许多应用程序中全局使用这个标签栏:)

tabBar.tintColor = [UIColor redColor];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM