How to present the same modalView after dismissing it once

Posted by David Casillas on Stack Overflow See other posts from Stack Overflow or by David Casillas
Published on 2011-11-15T08:58:44Z Indexed on 2011/11/15 9:51 UTC
Read the original article Hit count: 300

I'm having some problem trying to present a modal view controller after it has been presented the first time, so I just start a little test method, it presents, dismisses and presents again the same controller modally.

// This is just test Code.
MYViewController *vc = [[MYViewController alloc] init];
[self presentModalViewController:vc animated:YES];
[self dismissModalViewControllerAnimated:YES];
[self  presentModalViewController:vc animated:YES];

I get the error:

2011-11-15 09:50:42.678 Proyecto3[1260:11603] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present modally an active controller <RootViewController: 0x6d9d090>.'

The documentation does not add any clue here.

© Stack Overflow or respective owner

Related posts about cocoa-touch

Related posts about modalviewcontroller