Search code examples
iphoneobjective-ccurlios4xcode4

crashing on ios device while navigation using UIModalTransitionStylePartialCurl in xcode 4


i am using UIModalTransitionStylePartialCurl on the ios 4 device,in my test app i have 2 classes where a single button in each class, in first page onclick of the button it ill navigate to 2nd page (by curling the page up) but in the 2nd page when i click backbutton its crashing but not navigating back to my first page following is my code used for navigation

ViewController *MainWin = [[QIAViewController alloc] initWithNibName:NULL bundle:NULL];
    MainWin.modalTransitionStyle = UIModalTransitionStylePartialCurl;
    [self presentModalViewController:MainWin animated:YES];
    [MainWin release];

this is the crash log:

 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present a nested modal view controller while curled <QIAAdminPassCnf: 0x583e040>.'
*** Call stack at first throw:

Solution

  • If you read the documentation for UIModalTransitionStylePartialCurl, you will see that once you've used it you can't present any more modal views.

    If you want to navigate back, I think you should do,

     [self dismissModalViewControllerAnimated:YES];
    

    rather than creating a new view controller instance.