I have a UITabBarController, which is the second item in a UINavigationBarController. Within the UITabBarController are a couple of views, one of which is a UIViewController subclass called AccountViewController. Got that?
Login View Controller -> UIViewController + UITabBarController - > Account View Tab -> Button
I want to use a button – Logout – to pop back to the Login view. How would I do that?
Assuming you are creating the
UITabBarControllerwithin one of theUIViewControllerswhich are part of the string of view controllers within theUINavigationControllerwhere you have done something similar to this:You can call this from within one of the
UIViewControllersthat are added to yourmytabs.viewControllersarray like so:You can also specify if you want it to go to a specific viewController index in the UINavigationController stack ( just in case your Login viewController isn’t the next one down or the root view controller ).