How do you customise the title on a UITabBarItem?

大兔子大兔子 提交于 2019-12-10 12:56:23

问题


When using the method initWithTabBarSystemItem to create a UITabBar object is there a way to set the title? I've tried setting the title property (on the viewController and tab bar item) afterwards but it doesn't seem to make a difference. I know about the initWithTitle: image: method but I want to use one of the system icons with a custom title.


回答1:


If yo are using the systemItem you can't customize it, you will have to make a custom Item, and use the same or similar artwork... you could get the artwork from: http://www.teehanlax.com/blog/iphone-gui-psd/




回答2:


You can do it in two ways.

   UITabBarItem *tabBarItem = [[UITabBarItem  alloc ] init ];
   tabBarItem.title = @"Custom title";

or

Go to the interface builder ; Click on the UITabBarItem and edit it.



来源:https://stackoverflow.com/questions/6232594/how-do-you-customise-the-title-on-a-uitabbaritem

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