I am using XCode 7 & Objective C. My requirement is to show a viewcontroller in landscape mode. I am able to do it successfully using the following methods.The situation in the iPhone app is that my first View Controller is Portrait. It has a button. When we click on it, the Unity 3D app should open in Landscape. I want to keep a loading view in between.
- (UIInterfaceOrientationMask)supportedInterfaceOrientations{
if(self.isGoingToVrView == NO)
{
loadingLabel.text = @"Rotate your device to begin";
NSLog(@"Return Portrait");
return UIInterfaceOrientationMaskPortrait;
}
else{
landscapeView.frame = CGRectMake(0, 0,667.000000, 375.000000);
loadingLabel.text = @"Loading...";
NSLog(@"Return Landscape");
[UIViewController attemptRotationToDeviceOrientation];
return UIInterfaceOrientationMaskLandscapeRight;
}}
- (BOOL)shouldAutorotate{
NSLog(@"%s",__PRETTY_FUNCTION__);
return YES;}
But the problem is that it does not go to Landscape & remains stuck in Portrait if someone has switched On the Portrait Orientation Lock : ON from the Control Center as shown in this screenshot. Let me know if anyone knows how to overcome this.