I want to add Tabbar to my application. Tabbar is not visible even though I have already added the codes. How do I add AppDelegate
if I can't add it from UITableViewController
? What had I better do?
class MainTableViewController: UITableViewController {
private func tabbar() {
let tabBarController = FluidTabBarController()
tabBarController.tabBar.tintColor = UIColor(red: 0.2431372549, green: 0.4235294118, blue: 1, alpha: 1)
let viewControllers = [
("News", #imageLiteral(resourceName: "output-onlinepngtools")),
].map(createSampleViewController)
tabBarController.setViewControllers(viewControllers, animated: true)
}
private func createSampleViewController(title: String, icon: UIImage) -> UIViewController {
let viewController = UIViewController()
viewController.view.backgroundColor = #colorLiteral(red: 0.9490196078, green: 0.9529411765, blue: 0.968627451, alpha: 1)
let item = FluidTabBarItem(title: title, image: icon, tag: 0)
item.imageColor = #colorLiteral(red: 0.7960784314, green: 0.8078431373, blue: 0.8588235294, alpha: 1)
viewController.tabBarItem = item
return viewController
}
override func viewDidLoad() {
super.viewDidLoad()
tabbar()
}
}