iOS : How to avoid program quit during the 2nd call viewController?

I've an iPad app that can call the 2nd viewController by pressing a next button. But when I press the next button, it is successfully called the 2nd viewController but when I press return the program quits (Program received signal). Anything wrong with my Xcode4 ?

.m mainController -(IBAction) next{ UIViewController * about = [[UIViewController alloc] initWithNibName:@"about" bundle:nil]; [self presentModalViewController:about animated:YES]; [about release]; }

.m 2nd viewController

- (IBAction)btnReturn { [self.view removeFromSuperview]; [self dismissModalViewControllerAnimated:YES]; } - (void)dealloc { [UIViewController release]; [super dealloc]; }

-------------Problems Reply------------

These two lines make no sense, you should remove them:

  1. [self.view removeFromSuperview];
  2. [UIViewController release];

Line 1: You don't have to remove your view from the superview. Dismissing the modal controller should be sufficient.

Line 2: If anything, you should release an object, not a class.

Category:model view controller Views:1 Time:2011-12-08

Related post

Copyright (C), All Rights Reserved.

processed in 0.159 (s). 11 q(s)