swift - Google 和 Facebook 登录 Controller 在 Xcode 11 iOS 13 中模态呈现

标签 swift uiviewcontroller ios13 xcode11 uimodalpresentationstyle

我已经将 pod 更新到最新版本并且

重写方法

override func present(_ viewControllerToPresent: UIViewController,
                      animated flag: Bool,
                      completion: (() -> Void)? = nil) {
  viewControllerToPresent.modalPresentationStyle = .fullScreen
  super.present(viewControllerToPresent, animated: flag, completion: completion)
}

所有其他 Controller 都呈现全屏,但 Google 和 Facebook 登录仍以页面形式呈现。

如何像之前那样全屏显示它们?

Facebook Login Screenshot Google Login Screenshot

提前致谢!

已更新

我找到了解决方法。如果我将我的 LoginViewController 设置为窗口的 rootViewController,那么它们会全屏显示,但如果我从 UINavigationController 中显示它们,它们就会模态显示。

    func showSignUpScreen() {
      let controller:SignUpViewController =   UIStoryboard.instantiateViewController(storyboardName: .loginSignup, viewControllerIdetifier: "SignUpViewController") 
      self.navigationController?.interactivePopGestureRecognizer?.isEnabled = false

      //Presents full Screen
      UIApplication.shared.delegate?.window??.rootViewController = controller

      //Presents Modally
      self.navigationController?.pushViewController(controller, animated: false)
}

但我无法始终显示,因为在窗口上显示时标签栏会被隐藏。我需要标签栏来显示不需要登录的其他屏幕。

Tab Bar Presented on window

最佳答案

以下用于在全屏模式下显示 safari View 的扩展

import SafariServices

extension  SFSafariViewController {
    override open var modalPresentationStyle: UIModalPresentationStyle {
        get { return .fullScreen}
        set { super.modalPresentationStyle = newValue }
    }
}

关于swift - Google 和 Facebook 登录 Controller 在 Xcode 11 iOS 13 中模态呈现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58625863/

相关文章:

ios - 调用了 VIewDidLoad 但未加载 View

ios - 从 swift 中的 NSObject 类执行 UIViewController 中的函数

ios - (SIGABRT尝试使用未知的类项目名称)EXC_BAD_ACCESS错误在Xcode 11,Swift 5,iOS 13中的强引用变量上

iOS 13 : Using the new NEHotspotConfiguration. init(ssidPrefix: String) 似乎不起作用

ios - 使用 Swift (iOS) 和照片框架保存自定义图像的元数据

swift - “ fatal error :在展开可选值时意外发现nil”是什么意思?

ios - viewWillTransitionToSize : vs willTransitionToTraitCollection:

ios - 通过 UIToolBar 的 UIBarButtonItem 在 iOS13 上不显示

ios - 变量不是 nil 但代码认为它是 nil

ios swift - 返回到隐藏导航栏的屏幕时,导航项背景变黑