如何将rootViewController从UIInputWindowController更改为UINavigationController

问题描述 投票:0回答:1

那里
CardinalMobile SDK 显示 OTP 屏幕,在 OTP 屏幕关闭后,我无法显示从 SVProgressHUD 的加载。 我检查了 rootViewController,它已从 UINavigationController 更改为 UIInputWindowController。

这里有人可以帮忙吗? 我花了将近一周的时间试图修复它。

swift objective-c
1个回答
0
投票

操纵 rootViewController 可能会导致不可预测的行为。

假设SVProgressHUD没有自动找到正确的窗口,您可以手动指定容器视图。

DispatchQueue.main.async {
if let keyWindow = UIApplication.shared.windows.filter({ $0.isKeyWindow }).first {
    SVProgressHUD.setContainerView(keyWindow)
    SVProgressHUD.show(withStatus: "Loading...")
}

}

对于 iOS 13 及以上版本:

DispatchQueue.main.async {
if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene {
    if let keyWindow = windowScene.windows.filter({ $0.isKeyWindow }).first {
        SVProgressHUD.setContainerView(keyWindow)
        SVProgressHUD.show(withStatus: "Loading...")
    }
}

}

© www.soinside.com 2019 - 2024. All rights reserved.