Google 和 Facebook 登录控制器在 Xcode 11 iOS 13 中模态呈现
Google & Facebook Login Controllers presenting modally in Xcode 11 iOS 13
我已经将 pods 更新到最新版本并且
覆盖方法
override func present(_ viewControllerToPresent: UIViewController,
animated flag: Bool,
completion: (() -> Void)? = nil) {
viewControllerToPresent.modalPresentationStyle = .fullScreen
super.present(viewControllerToPresent, animated: flag, completion: completion)
}
所有其他控制器正在全屏显示,但 Google 和 Facebook 登录仍显示为页面 sheet。
如何像以前一样全屏显示它们?
提前致谢!
已更新
我找到了解决方法。如果我将我的 LoginViewController 设置为 window 的 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)
}
但我无法始终显示,因为在 window 上显示时标签栏会被隐藏。我需要标签栏来显示不需要登录的其他屏幕。
以下用于在全屏模式下显示 Safari 视图的扩展程序
import SafariServices
extension SFSafariViewController {
override open var modalPresentationStyle: UIModalPresentationStyle {
get { return .fullScreen}
set { super.modalPresentationStyle = newValue }
}
}
我已经将 pods 更新到最新版本并且
覆盖方法
override func present(_ viewControllerToPresent: UIViewController,
animated flag: Bool,
completion: (() -> Void)? = nil) {
viewControllerToPresent.modalPresentationStyle = .fullScreen
super.present(viewControllerToPresent, animated: flag, completion: completion)
}
所有其他控制器正在全屏显示,但 Google 和 Facebook 登录仍显示为页面 sheet。
如何像以前一样全屏显示它们?
提前致谢!
已更新
我找到了解决方法。如果我将我的 LoginViewController 设置为 window 的 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)
}
但我无法始终显示,因为在 window 上显示时标签栏会被隐藏。我需要标签栏来显示不需要登录的其他屏幕。
以下用于在全屏模式下显示 Safari 视图的扩展程序
import SafariServices
extension SFSafariViewController {
override open var modalPresentationStyle: UIModalPresentationStyle {
get { return .fullScreen}
set { super.modalPresentationStyle = newValue }
}
}