views:

209

answers:

1

I add 3 views for an application and they need to switch from 1-2-3.

Now I add a toolBar and a button 'OK' on the bottom of SwitchViewController, so they can share the button to go to next view.

But how to add a 'Back' button so that I can switch from 2-1 or 3-2 and the button shouldn't be seen in the first view? Are there any other ways to switch views without sharing the same tool bar button?

+1  A: 

It sounds like what you're trying to do is use a UINavigationController. If you instantiate a UINavigationController with the initWithRootViewController initializer you can pass it your first UIViewController. Then you just need to tie whatever action you want to a method that calls [myUINavigationController pushViewController:myOtherViewController animated:YES] to get it to slide over to the second view. The UINavigationController will automatically set up the UINavigationBar and back button you are looking for.

Andy Bourassa