Tring to add an overlay window to the key UIWindow in the IOS app. However, it seems that the new overlay UIWindow is not anywhere visible.
It seems that it is being added successfully though, based on 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>>
In the debug,
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
}
Would appreciate any sort of hint/help thanks
Your window is being deallocated after your
viewDidLoad()
method exits. You need to strongly retain your second window.