无法在标签栏Swift2中向listview添加文本

时间:2015-08-27 20:16:59

标签: swift tabbar tabbarcontroller

我使用此代码将标题设置为tabbar项目。它适用于前5个。但是当第六个应该在"更多"下的列表视图中添加文本。应用程序崩溃。如何在该列表上设置文本?

    let tabArray = self.tabBarController?.tabBar.items as NSArray!

    let tabItem1 = tabArray.objectAtIndex(0) as! UITabBarItem
    let tabItem2 = tabArray.objectAtIndex(1) as! UITabBarItem
    let tabItem3 = tabArray.objectAtIndex(2) as! UITabBarItem
    let tabItem4 = tabArray.objectAtIndex(3) as! UITabBarItem
    let tabItem5 = tabArray.objectAtIndex(4) as! UITabBarItem
    let tabItem6 = tabArray.objectAtIndex(5) as! UITabBarItem

    tabItem1.title = "Home"
    tabItem2.title = NewArray().12
    tabItem3.title = NewArray().13
    tabItem4.title = NewArray().14
    tabItem5.title = NewArray().15
    tabItem6.title = NewArray().16

0 个答案:

没有答案