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];
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.