A new navigation stack is created. You will need to add your own back button and set the action of this delegate method on the calling VC to reject it.
UPDATE: There seems to be a lot of confusion about where and how to reject ModalViewControllers. In most cases, the wrong thing is to call the Dismiss method from the modal VC itself if you want the parent to act on this dismissal. Use delegation instead. Here is a simple example:
ModalViewController.h:
@protocol ModalViewControllerDelegate -(void)dismissMyModalVC; @end @interface ModalViewController : UIViewController { id < ModalViewControllerDelegate > delegate; } @property (nonatomic, retain) id < ModalViewControllerDelegate > delegate;
ModalViewController.m
@synthesize delegate;
...
CallingViewController.h:
#import "ModalViewController.h" @interface CallingViewController : UIViewController <ModalViewControllerDelegate> // Rest of class here
CallingViewController.m:
ModalViewController *mvc = [[ModalViewController alloc] initWithNibName:@"ModalViewController" bundle:nil]; mvc.delegate = self [self presentModalViewController:mvc animated:YES];
...
Thus, the VC receives a proper deviation from the controller that created it. This delegate method can be modified to traverse objects (for example, when you finish user logging, etc.)
source share