Search code examples
iphonebuttonviewnavigationback

Back button in iphone app


I have a simple single View application with a button in the main view which sends me off to another view with an independent xib file. On this second view I have a button that should send me back to the main view. I'm not using a navigation controller.

Can anyone tell me how to program this "back" button so it will display the main view again?

Thanks so much in advance.


Solution

  • If you called the second viewcontroller like this:

    [self presentModalViewController:secondViewController animated:YES];
    

    You can dismiss it like this:

    [self dismissModalViewControllerAnimated:YES];