我在以编程方式创建标签栏时遇到了一些问题。我创建了创建标签栏的类:
覆盖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
}
但它不起作用......