4

iPhone ModalViewController: In iOS 4, it is possible to dismiss multiple ModalViewControllers using:

[[[[self parentViewController] parentViewController] parentViewController]
       dismissModalViewControllerAnimated:YES];

In iOS 5, the code is not working.

How do I dismiss multiple modalViewControllers in iOS 5?

johnluttig
  • 750
  • 1
  • 9
  • 24

2 Answers2

6

yeah, this is an annoying change. for modal view controllers, you now have to call presentingViewController instead of parentViewController

Mike K
  • 2,227
  • 1
  • 12
  • 6
0

Hi In iOS 5 Use the below Code

[[[self presentingViewController] presentingViewController] dismissModalViewControllerAnimated:YES];