更改标签栏控制器中的视图

时间:2016-04-23 15:14:34

标签: ios swift uitabbarcontroller

我在以编程方式创建标签栏时遇到了一些问题。我创建了创建标签栏的类:

覆盖func viewWillAppear(动画:Bool){

i+1

在viewDidLoad中,我尝试使用以下内容更改起始视图:

    let mondayTab = MondayTableViewController()
    mondayTab.tabBarItem.title = "Monday"
    mondayTab.tabBarItem.image = UIImage(named: "")

    let tuesdayTab = TuesdayTableViewController()
    tuesdayTab.tabBarItem.title = "Tuesday"
    tuesdayTab.tabBarItem.image = UIImage(named: "")

    let wednesdayTab = WednesdayTableViewController()
    wednesdayTab.tabBarItem.title = "Wednesday"
    wednesdayTab.tabBarItem.image = UIImage(named: "")

    let thursdayTab = TuesdayTableViewController()
    thursdayTab.tabBarItem.title = "Thursday"
    thursdayTab.tabBarItem.image = UIImage(named: "")

    let fridayTab = TuesdayTableViewController()
    fridayTab.tabBarItem.title = "Friday"
    fridayTab.tabBarItem.image = UIImage(named: "")

    let tabBarController = [mondayTab, tuesdayTab, wednesdayTab, thursdayTab, fridayTab]
    self.viewControllers = tabBarController

}

但它不起作用......

0 个答案:

没有答案