Our app's device orientation is only portrait, but have one video player view which need to rotate to landscape and rotate back;
I try to use supportedInterfaceOrientationsForWindow method in AppDelegate, but it seems not work anymore?
Xcode 8.3.3, iOS 10.3.2, Deployment Targit is 8.0.
Need I paste the code?
If you're making use of the
windowmethod parameter, try usingself.windowinstead. During rotation,windowis a_UIInteractiveHighlightEffectWindowand might not be what you need.I have code in
supportedInterfaceOrientationsForWindowthat returns differentUIInterfaceOrientationMaskvalues depending on which view controller is visible. When finding the visible view controller on thewindowmethod parameter during a segue from a portrait view controller to a landscape view controller, the visible view controller was always a genericUIViewControllerclass with no navigation controller, parent view controller, child view controllers, or subviews.When using
self.windowinstead, the visible view controller was the one I expected (one of the view controllers that needed to be displayed in landscape).Here's an example of the difference between
windowandself.windowwhen the method is called during rotation: