My app has Portrait mode only, as follow image: Device Orientation
But it needs to support Landscape mode in customized UIViewController. I have override follow functions:
- (BOOL)shouldAutorotate
{
return NO;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeRight;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
It worked in most cases, but somehow it would acted like follow image: problem picture
There seems to have a conflict between the device orientation and MyViewController orientation.
PS: My device is iPhone 6s Plus, system is iOS 10.0, this problem also exist in iPhone 6s.