在IOS应用程序中添加一个覆盖窗口到UIWindow键。 但是,新的叠加UIWindow似乎无处可见。
基于lldb:
,它似乎已成功添加(lldb) po UIApplication.shared.windows
▿ 2 elements
- 0 : <UIWindow: 0x7fdfd3d0aec0; frame = (0 0; 375 667); gestureRecognizers = <NSArray: 0x60800004d680>; layer = <UIWindowLayer: 0x608000220980>>
- 1 : <UIWindow: 0x7fdfd3c0d010; frame = (0 0; 375 667); gestureRecognizers = <NSArray: 0x60000004c9c0>; layer = <UIWindowLayer: 0x6000002216e0>>
在调试中,
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let vc = UIViewController()
vc.view.backgroundColor = UIColor.blue
let window = UIWindow()
window.frame = self.view.bounds
window.backgroundColor = UIColor.blue
window.windowLevel = UIWindowLevelStatusBar
window.rootViewController = vc
window.isHidden = false
}
会欣赏任何提示/帮助 感谢
答案 0 :(得分:2)
退出viewDidLoad()
方法后,您的窗口将被取消分配。您需要强烈保留第二个窗口。