well, I'm trying to connect 3 view controllers with 3 tab bar items in one tab bar, I searched here for the way and I found multiple answers such as: How do you connect a tab bar item to an action? and set up an action with a tab bar item - iphone but i could not figure it out, here is my code:
class TabBar: UIViewController, UITabBarDelegate {
func tabBar(tabBar: UITabBar, didSelectItem item: UITabBarItem) {
if(item.tag == 1) {
let us = self.storyboard?.instantiateViewController(withIdentifier: "Th5ViewController") as! Th5ViewController
self.navigationController?.pushViewController( us, animated: true)
}
else if(item.tag == 2) {
//your code for tab item 2
}
else if(item.tag == 3) {
//your code for tab item 2
}
}
}
so, what I missed? I think it a small rational detail. thank you.