iOS7 UIModalTransitionStyleFlipHorizontal 过渡后反弹 [英] iOS7 UIModalTransitionStyleFlipHorizontal bounces after transition
问题描述
我正在为 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 中导航栏在转换后弹跳.这和状态栏有关系吗?我已将主导航栏的半透明设置为 NO
.
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).
这篇关于iOS7 UIModalTransitionStyleFlipHorizontal 过渡后反弹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!