调用 presentViewController:animated:completion: 不会在 iOS7 中设置动画。 View 立即出现。动画在 iOS8 中正常工作。在我的应用程序中的三个不同位置调用了当前方法,它们都显示了此行为。它发生在设备和模拟器上。
随后对 dismissViewControllerAnimated:completion: 的调用在所有 iOS 版本中都可以正确设置动画。
调用当前方法的 View Controller 是 UINavigationController 的 Root View Controller ,而该导航 Controller 是 UITabBarController。 viewControllers 之一
每次调用都很简单,只需按下按钮即可触发。这是其中一个案例:
GenreViewController *controller = [[GenreViewController alloc] init];
[ self 呈现 View Controller :动画 Controller :是完成:无];
[UIView setAnimationsEnabled:YES]在每种情况下,行为都没有改变。
任何帮助将不胜感激!
事实证明,UITabBarController 将 modalPresentationStyle 属性设置为 UIModalPresentationCurrentContext。这在 iOS7 中不会显示动画,您必须改用 UIModalPresentationFullScreen 的呈现样式。
最佳答案
你可以用这个
GenreViewController *addController = [[GenreViewController alloc]
init];
UINavigationController *navigationController = [[UINavigationController alloc]
initWithRootViewController:addController];
[self presentViewController:navigationController animated:YES completion: nil];
关于ios - UIViewController presentViewController 模态在 iOS7 中没有动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31160738/