I am developing an application which has several views. I create different xib & view controller for each view. To open each view on button click using code:
-(IBAction)NextView{
NextViewController *screen = [[NextViewController alloc] initWithNibName:nil bundle:nil];
screen.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:screen animated:YES];
[screen release];
}
I use the same method from that view to open the next. To close a view I use:
-(IBAction)ReturnMainMenu {
[self dismissModalViewControllerAnimated:YES];
}
How can I come back to the main view from the last view (say 4th view) from a button to start again, instead of closing each with button?
Try this:
Also the method returns an NSArray of the controllers that were popped if you need to keep a track, like: