Dismissing Multiple View Controllers in iOS 5?

I have an app that closes nested modal view controllers through NSNotificationCenter. The notification is received by the VC that I want to navigate back to and all the VC's in between are gone.

Up vote 0 down vote favorite share g+ share fb share tw.

In iOS 4, if you want to dismiss two nested modal view controllers, the following code works: self parentViewController parentViewController parentViewController dismissModalViewControllerAnimated:YES; However in iOS 5 this method no longer works. Does anybody know how to achieve this result in iOS 5? Objective-c ios ios5 modalviewcontroller link|improve this question asked Jan 10 at 4:15Andrew Barinov36418 93% accept rate.

– Maudicus Jan 10 at 4:17 Nothing happens. The modal view stays exactly where it is. – Andrew Barinov Jan 10 at 4:18.

I have an app that closes nested modal view controllers through NSNotificationCenter. The notification is received by the VC that I want to navigate back to and all the VC's in between are gone. In the deeper VC... NSNotification * notification = NSNotification notificationWithName:@"BACKTOINDEXNOTE" object:nil; NSNotificationCenter defaultCenter postNotification:notification; In the VC I would like to go back to - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = super initWithNibName:nibNameOrNil bundle:nibBundleOrNil; if (self) { NSNotificationCenter defaultCenter addObserver:self selector:@selector(dismiss) name:@"BACKTOINDEXNOTE" object:nil; // more init code } return self; } -(void)dismiss { self dismissModalViewControllerAnimated:YES; } This works on iOS 5 device with a project deployed for 4.0+ I hope it helps.

If you use this, it will scale to support more VC's in between your current VC and the one you want to dismiss to, without changing this code.

That worked like a charm! – Andrew Barinov Jan 10 at 4:56.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions