0

I need to go to home page when I click on Home tab item. Even when I am in an inside page of any tab , any page.

enter image description here

Note : The whole tab bar controller is embedded in a navigation controller and navigated to tab bar controller from another page.

NavodaP
  • 218
  • 3
  • 18
  • What did you try? – Milan Nosáľ Jan 22 '18 at 11:33
  • I tried pop view controller , but if it does not work when you are in another tab. – NavodaP Jan 22 '18 at 11:35
  • `UITabBarController` should automatically change the tab to the one you selected. I don't really understand your problem and what you are trying to do. You should probably include your code (minimal relevant example) and describe a case that does not work as expected – Milan Nosáľ Jan 22 '18 at 11:38

1 Answers1

2

Please try to remove your view controller from navigation stack before you select another tab.

self.navigationController!.viewControllers.removeAll() // to remove all view controllers from stack
self.navigationController?.viewControllers.remove(at: "insert here a index") // to remove specific view controller - enter index

Hope it works

Cheer :)

  • This works partially, If i'm inside a viewcontroller which is navigated from home tab cannot use this approach – NavodaP Jan 23 '18 at 05:01