UIWindow with wrong size when using landscape orientation

后端 未结 6 883
南旧
南旧 2020-12-08 21:27

I have an empty application and there is no storyboard or xib involved. I want to have a hidden status bar and support only landscape orientation. Again, I wan\'t to make th

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-08 22:29

    You can rotate UIWindow by adding single line only. 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.

提交回复
热议问题