0

I need to load a uiwindow from my storyboard and place this above all other windows. From what I've seen online the process for this has changed with iOS 13.

I'm aware of other answers that show how to set a new root VC at start up. However I need to change rootVCs back and forth between multiple view controllers within my storyboard based on user action.

At the moment I'm running the following 'pre-ios13' code but I'm getting warnings that this approach is no longer supported.

blackoutWindow.frame = UIScreen.main.bounds
blackoutWindow.backgroundColor = .black
blackoutWindow.windowLevel = UIWindow.Level.statusBar + 1
blackoutWindow.rootViewController = self as? UIViewController
blackoutWindow.makeKeyAndVisible()

Any help appreciated.

user1542125
  • 593
  • 6
  • 16
  • why you need to switch windows instead of ViewControllers?? – m1sh0 Apr 13 '20 at 07:01
  • I need for the second controller or window to complete cover the original window, which has an avplayer instance playing a video. Can I do that with a VC? – user1542125 Apr 13 '20 at 07:14
  • I think so, you can use containers for several view controllers in one view controller. I'm not 100% sure about the case with the AVPlayer but I think it is a good option to give a try. Instead of changing the window. – m1sh0 Apr 13 '20 at 07:31
  • I'll look into that. Thanks – user1542125 Apr 13 '20 at 07:46

0 Answers0