【问题标题】:Change the UITabBar Title on xCode / using Swift使用 Swift 在 xCode / 上更改 UITabBar 标题
【发布时间】:2016-01-31 10:50:24
【问题描述】:

情节提要中有一个 UITabbar 和 3 个 UITabItem。有一个 tabitem 系统项目被设置为历史。显示历史系统图标和系统标签历史。我可以将文本“历史”更改为“测试”吗?

【问题讨论】:

  • 您需要以编程方式更改它还是可以通过 Interface Builder 更改它?

标签: xcode swift swift2


【解决方案1】:

把这个写在viewdidload()中

let tabItems = self.tabBar.items as [UITabBarItem]
let tabItem0 = tabItems[0] as UITabBarItem
let tabItem1 = tabItems[1] as UITabBarItem
let tabItem2 = tabItems[2] as UITabBarItem
tabItem0.title = "TitleThatYouWant-1"
tabItem1.title = "TitleThatYouWant-2"
tabItem2.title = "TitleThatYouWant-3"

【讨论】:

  • 感谢您的信息。试过这个它不适用于历史系统项目
猜你喜欢
  • 2015-09-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-10-29
  • 2015-06-29
  • 1970-01-01
  • 1970-01-01
  • 2015-02-11
相关资源
最近更新 更多