iPhone - UIWindow rotating depending on current orientation?

Viewed 18172

I am adding an additional UIWindow to my app. My main window rotates correctly, but this additional window I have added does not rotate.

What is the best way to rotate a UIWindow according to the current device orientation?

5 Answers

You can set the rootController for your UIWindow. e.g:

fileprivate(set) var bottonOverlayWindow = UIWindow()

self.bottonOverlayWindow.rootViewController = self; 

// 'self' will the ViewController on which you had added UIWindow view. So whenever you ViewController change the orientation, your window view also change it's orientation.

Let me know if you face any issue.

Related