Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ios6 Rotation issue from landscape to portrait mode

Tags:

iphone

ios6

I am using New orientation methods of ios 6 and it is working fine. My view is presenting in portrait mode and when I presentviewcotrnoller and rotate it to landscape , dismiss that viewcontroller it reverts orientations. means it should remain in landscape but it becomes to portrait. Here is my code.

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskAll;

}

// Tell the system It should autorotate
- (BOOL) shouldAutorotate {
    return YES;
}

// Tell the system which initial orientation we want to have
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    return UIInterfaceOrientationMaskPortrait;
}

I think it is happening because of preferredInterfaceOrientationForPresentation method ,but not getting the solution for this.Please Help !

Thanks !!

like image 965
iProgrammer Avatar asked Oct 03 '12 12:10

iProgrammer


People also ask

Why does my phone switch from landscape to portrait?

Rotate your phone to change the screen orientation (if Auto Rotate is enabled). If Auto Rotate is enabled, your phone's screen will automatically flip to portrait mode when you are holding it upright.

Why is my screen orientation not changing?

If the Android screen rotation not working happens to you , or you're just not a fan of the feature, you can re-enable screen auto-rotate on your phone. Find and turn on the "Auto-rotate" tile in the quick-setting panel. You can also go to Settings > Display > Auto-rotate screen to turn it on.

Why won't my iPhone screen change orientation when I turn it sideways?

Swipe down from the top-right corner of your screen to open Control Center. Tap the Portrait Orientation Lock button to make sure that it's off. Turn your iPhone sideways.


1 Answers

If you want all the interfaceOrientations supported at the start, do not write the preferredInterfaceOrientationForPresentation method, as it would take just that preferred Interface orientation all the time.

like image 183
mayuur Avatar answered Sep 28 '22 18:09

mayuur