11
votes

I noticed in iOS8, when I'm pushing a new UIViewController in a UINavigationController, the old UIViewController slides out but is visible in my new top foreground UIViewController if it has a non opaque background.

When the push is done, the old controller just disappears, leaving the whole animation looking rough.

Previous to iOS8 you would not see the view behind the one getting pushed in even if it was transparent. As if there was a mask that slid in as well. Anyone know of a good way to fix this so it's like the old behavior without re-implementing the entire push animation with a custom animation?

enter image description here

2
Did you ever find a good solution for this?Lizza
Did you ever find a good solution for this?iosMentalist
I just worked around it by fading the views in and out.paranoidroid

2 Answers

2
votes

It's not a bug, it's standard behavior of UINavigationController.

During push transition, UINavigationController slide first controller slower than second. After animation of second contoroller finished, UINavigationController remove first view controller. If second view controller has transparent background, you see first controller during transition.

You have 3 ways to reach your goal:

  1. Add the same background (not transparent) to second ViewContorller.
  2. Create custom transition, like described here: Navigation controller custom transition animation
  3. Make transitions by using UIView animation.
-2
votes

This is what worked for me:

ios7:

presentingVC.modalPresentationStyle = UIModalPresentationCurrentContext;

ios8:

modalVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;
modalVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;

(modalVC being the view that you are going to present)

and then in both:

[presentingVC presentViewController:modalVC animated:YES completion:nil];

here is the original source: http://www.raywenderlich.com/forums/viewtopic.php?f=2&t=18661