iOS7 UIModalTransitionStyleFlipHorizontal在转换后反弹
我正在为iOS 7更新我的应用程序,我发现了一个奇怪的问题。我将使用 UIModalTransitionStyleFlipHorizontal
呈现包含在UINavigationController中的UIViewController。
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
.
在iOS 6中它工作正常,但在iOS 7中,导航栏在转换后反弹。这与状态栏有关吗?我已将主导航栏的半透明度设置为否
。
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
.
在Info.plist中,查看基于控制器的状态栏外观设置为NO。
In the Info.plist, View controller-based status bar appearance is set to NO.
这是一个GIF,在最小的演示应用程序中显示问题:
And here is a GIF showing the problem in a minimal demo app:
这是我的代码:
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];
这似乎是一个UIKit错误。以下解决方法似乎为我解决了这个问题。
This appears to be a UIKit bug. The following workaround seems to resolve the issue for me.
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.navigationController.navigationBar.layer removeAllAnimations];
}
(将此位置放在正在转换的视图控制器中强>)。
(Place this in the view controller you are transitioning to).