ios - 在 iOS 9 中,为什么 SFSafariViewController 被推送而不是模态呈现?

标签 ios iphone uiviewcontroller ios9 sfsafariviewcontroller

我通过在 UIViewController 实例上调用 presentViewController:animated:completion: 来呈现一个 SFSafariViewController

结果是它被推送(从右边滑入),就好像我在 UINavigationController 上调用了 pushViewController:animated: > 实例。我已经证实这一切都发生在主队列上。并且呈现 View Controller 本身不是模态(这应该无关紧要,但为了以防万一,我们可以排除这种可能性)。

如果我将 SFSafariViewController 替换为 UIViewController,它会按预期工作,以模态方式呈现。

weakSelf.oAuthViewController = [[SFSafariViewController alloc] initWithURL:url];
[viewController presentViewController:weakSelf.oAuthViewController animated:YES completion:nil];

知道为什么或如何解决这个问题吗?

最佳答案

这是获得 SFSafariViewController 垂直模态显示的简单方法:

let safari = SFSafariViewController(URL: url)
safari.modalPresentationStyle = .overFullScreen
presentViewController(safari, animated: true, completion: nil)

关于ios - 在 iOS 9 中,为什么 SFSafariViewController 被推送而不是模态呈现?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35629063/

相关文章:

iphone - 如何让 UIWebView 从它自己的应用程序显示 pdf 文件?

iphone - 不使用 Interface Builder 修改 Nib 文件

iphone - 在 iOS6 中,在将 ViewController 压入堆栈时无法将其强制为特定的界面方向

ios - 将类与 Root View Controller 连接(UINavigationController)

ios - UIViewController 标题不能是 "Message"吗?

ios - 与 UIPageControl 一起使用时, Collection View 高度不正确

ios - 如何使枚举符合 Swift 中的可识别协议(protocol)?

iphone - 如何阻止 iOS PinchGesture 选择按钮?

ios - touchesEnded的点坐标从哪里来?

iphone - 无法使用对 armv7s 的支持来更新我现有的应用程序(支持 armv6)?