I'm updating my app for iOS 7 and I discovered a weird problem. I'm presenting a UIViewController wrapped in a UINavigationController with UIModalTransitionStyleFlipHorizontal
.
In iOS 6 it works fine, but in iOS 7 the navigation bar bounces after the transition. Does this have something to do with the status bar? I've set translucency of the main navigation bar to NO
.
In the Info.plist, View controller-based status bar appearance is set to NO.
And here is a GIF showing the problem in a minimal demo app:
Here is my code:
feedNavigationController = [[UINavigationController alloc] init];
feedNavigationController.navigationBar.translucent = NO;
SettingsViewController *settingsVC = [[SettingsViewController alloc] init];
feedNavigationController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[feedNavigationController setViewControllers:[NSArray arrayWithObjects:settingsVC, nil]];
[self presentViewController:feedNavigationController animated:YES completion:nil];
The same for me. What actually worked is to change style to CoverVertical, looks much smoother.
This appears to be a UIKit bug. The following workaround seems to resolve the issue for me.
(Place this in the view controller you are transitioning to).
For both the presenting and the presented view controller I have a
UITableViewController
withinUINavigationController
, both configured using Auto Layout. I noticed that the other answers didn't solve the problem that on dismiss the tableView of the presenting view controller jumps 20 pt vertically.This solution addresses this problem.
In the presented view controller (as proposed by Ben Packard):
In the presenting view controller (as proposed in part by dusty):
To solve this problem for present & dismiss, I use the iOS7 custom transition.
Add this to your UIViewController :
To use it, you just had to check if you are on iOS7 and set the transitionDelegate :
In my case, I had a custom UINavigationController where the custom transition is defined : i don't have to do this each time.
I had the same issue and could "solve it" (it's not a real solution to the problem but it looks fine :) ). The trick is present the view controller using
pushViewController
/popViewController
with anUIView
animation to make a flip. Here is a example code to present the view controller:To dismiss it:
If you don't want the
navigationBar
on the pushed controller just call[self.navigationController setNavigationBarHidden:YES animated:NO]
inviewWillAppear
. I hope this approach help you.This appears to be a UIKit bug. The following workaround seems to resolve the issue for me.
presentViewController
(place this in the view controller you are transitioning to):dismissViewControllerAnimated
(place this in the view controller you dismiss to):if you don't use
autolayout
. you need add this to the view controller youdismiss
to: