-2

I have a viewController which displays a map with annotations. When I click on a bar button, another viewController is supposed to animate on top of that. This works, BUT, when the animation completes, the viewController in the back disappears. It reappears again when the animated viewController closes again.

Here is a video of what happens - hopefully that will make things more clear:

Let me know if I should include the code as well.

Irfan
  • 4,161
  • 6
  • 27
  • 45
Nilzone-
  • 2,646
  • 5
  • 31
  • 67

1 Answers1

1

When you present a view controller it is expected to take the full screen. As such, the view controllers 'below' it have their views removed from the stack to save resources which are expected to not be required.

You can change your presented view controller to do something like:

  1. Either, don't be presented, just add a subview and animate it in.
  2. Or, pass an image of the original view to the presented view, this becomes the background and that presented view animates a subview in over the image background.
Wain
  • 117,132
  • 14
  • 131
  • 151
  • Note: As mentioned in the link in the comment by Kumar KI, in iOS7 if you set the `modalPresentationStyle` to `UIModalPresentationCustom` your background viewController will remain. – Mike Pollard Jan 30 '14 at 11:56
  • I debugged my code a litta bit - in my completion block i write: [transitionContext completeTransition:YES]. If i just set that ti nil - the transition "freezes" BUT the view in the back does not go away. – Nilzone- Jan 30 '14 at 12:00
  • The transition completion is the trigger to remove non-required resources because that is when the source view is no longer visible. – Wain Jan 30 '14 at 12:11