UITabBarItem with custom title color and images

最后都变了- 提交于 2019-12-03 07:54:54

And I'm one of the people that says that it really doesn't work. You have to reimplement the whole functionality in a Custom UIViewController which acts as a UITabBar replacement.

Just like Twitter for iPhone or Tweetbot did.

In iOS 5.0 and newer, you can Customize UITabBar's Appearance by changing the tint color, the background image and the selection indicator, to make them look the way you like.

You can also customize the individual UITabBarItems, by invoking the setFinishedSelectedImage:withFinishedUnselectedImage: method with finished selected and unselected images as parameters.

Alternatively, modifying the appearance proxy of UITabBar allows you to change the aspect of all its instances.

Totally not customizable. You either use whatever Apple provided to you (mask images for shapes and titles) or you roll your own.

One way that has worked for me is subclassing the tab bar. Use your own subviews to make the tab bar look they way you want it to. For example: use a background image and dynamically overlay that with buttons for each of the tabBarItems.

This way you can still configure the tab bar in Interface Builder and you get the switching of the tab bar content for free. At the same time the tab bar will look the way you want.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!