Search code examples
iphoneobjective-ccocoacocoa-touchiphone-sdk-3.0

Problem dismissing multiple modal view controllers


I am having trouble getting my modal view controllers to display properly. I have a parent view controller that is the delegate for modal view A. In modal view A I am presenting modal view B, and having the delegate dimiss modal view A.

When modal view B appears it seems to display but the screen dims, and the UI locks up, but the app doesn't crash. I set animation settings to NO and I am still getting the same issue.

Order of events:

  1. Parent View show Modal View A
  2. Modal View A shows Modal View B in Modal View A controller
  3. Parent View dismisses Modal View A in Modal View A controller via delegation
  4. This is where my UI hangs, I can see Modal View B but can't click on it, or do anything

Solution

  • Solved by having my parentViewController act as the delegate. Here is my order:

    [parentView presentViewController:modalViewControllerA animated:YES]
    [parentView dismissModalViewControllerAnimated:YES]
    [parentView presentViewController:modalViewControllerB animated:YES]
    //Modal B dismisses himself
    

    In my delegate method, I needed to make sure that I dismissed Modal A before presenting Modal B