func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
self.window = UIWindow(frame:UIScreen.main.bounds)
let homeVC = ConstDetailViewController(nibName: "ConstDetailViewController", bundle: nil)
//homeVC.tabBarItem.title = "Home";
homeVC.tabBarItem.image = UIImage(named: "HomeRe.png")
// Settings controller
let settingsVC = LeaderboardViewController(nibName: "LeaderboardViewController", bundle: nil)
settingsVC.tabBarItem.image = UIImage(named: "search3.png")
let mapVC = MapViewViewController(nibName: "MapViewViewController", bundle: nil)
mapVC.tabBarItem.image = UIImage(named: "graphRe.png")
let userVC = UserProfileViewController(nibName: "UserProfileViewController", bundle: nil)
userVC.tabBarItem.image = UIImage(named: "UserRe.png")
self.tabBarController = UITabBarController()
self.tabBarController!.setViewControllers([homeVC, settingsVC,mapVC,userVC], animated: false);
let loginVC = ConstituencyViewController(nibName: "ConstituencyViewController", bundle: nil)
self.window!.rootViewController = loginVC
self.window!.makeKeyAndVisible()
I have set the tabbar controller in appdelegate. But now the button actions and other navigations are not working in my viewcontrollers. How can I set the navigation here? Please help
I have Show you here step by step Points. Please follow that-
Step1- AppDelegate:
Step2- Create New File of
UITabBarController
like:Step3 - In ViewController i.e first item of tab do your require things
Step4- Similarly SecondViewController i.e second item of tab
Step5- Your Login VC:
Step6- Another Controller i.e abc, I have button on SecondViewController to show Navigation and Tab bar for Subviews. Button will push this view controller.