有没有办法为UITabBar设置单独的短标题? [英] Is there a way to set a separate short title for UITabBar?
问题描述
我希望能够在标签栏上显示简短名称,而在表视图中链接相同视图时,可以提供更长(更具描述性)的名称。原因是,较长的名字在标签栏上互相微调。在表视图中,有更多的水平空间,所以我想使用更具描述性的标题。
通常,标签栏的标题在其视图控制器中设置 self.title
。是否有一种方法来专门设置选项卡栏标题,但单独保留视图控制器的 self.title
?
感谢。
在UITabBar中显示的信息从每个UIViewController的tabBarItem属性查询,类似地,UINavigationBar查询
<$ p 设置两个不同的标题将像这样工作(从UIViewController内): $ p>
self.tabBarItem.title = @TabTitle;
self.navigationItem.title = @NavigationTitle;
您还可以通过这些属性指定其他详细信息,如标签栏图像或后退按钮上的标题。
I'd like to be able to give my views short names for display on the tab bar, and longer (more descriptive) name when the same view is linked to in a table view. The reason is that longer names nudge up against each other on the tab bar. In a table view, there's more horizontal space, so I want to use more descriptive titles there.
Normally, the tab bar's title is set in its view controller with self.title
. Is there a way to specifically set the tab bar title, but leave the view controller's self.title
alone?
Thanks.
The information that is displayed in a UITabBar is queried from each UIViewController's tabBarItem" property. Similarly, a UINavigationBar queries the UIViewController's navigationItem for information.
Setting two different titles would work like this (from within you UIViewController):
self.tabBarItem.title = @"TabTitle";
self.navigationItem.title = @"NavigationTitle";
You can also specify other details like the tab bar image or the title on the "back button" via these properties.
这篇关于有没有办法为UITabBar设置单独的短标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!