App Support: iOS6+
My app works in both portrait and landscape. But 1 controller should only works in a Portrait.
The problem is that when I am in landscape and push the view controller the new viewcontroller is in landscape as well until I rotate it to portrait. Then it's stuck in portrait as it should be.
Is it possible to always make it appear in portrait? Even if its parent is pushing it in landscape?
All the following code doesn't help
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait];
And this code works until and unless i am not pushing from landscape How to force a UIViewController to Portrait orientation in iOS 6
Set the supportedInterfaceOrientations property of specific UIViewControllers like this: class MyViewController: UIViewController { var orientations = UIInterfaceOrientationMask. portrait //or what orientation you want override var supportedInterfaceOrientations : UIInterfaceOrientationMask { get { return self.
Select the Start button, then type settings. Select Settings > System > Display, and choose a screen orientation from the drop-down list next to Display orientation.
Open project in Xcode ( ios/Runner. xcworkspace ), choose Runner in the project navigator, select Target Runner and on Tab General in section Deployment Info we can setup Device Orientation : Setup a device orientation in Xcode.
I solved this by adding following lines in ViewDidLoad
UIViewController *c = [[UIViewController alloc]init]; [self presentViewController:c animated:NO completion:nil]; [self dismissViewControllerAnimated:NO completion:nil];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With