简体   繁体   中英

Any change in orientation definition in iOS 6

I have this:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

in my app view controllers, in iOS 5 it worked as expected but when I updated to iOS 6, the orientation definition doesnt seem to work, it is also showing landscape when oriented. Any change in method definition of any other settings?

in the AppDelegate :

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window  // iOS 6
{

return UIInterfaceOrientationMaskAll;


}

in your ViewController:

- (BOOL)shouldAutorotate {
return YES;
}

- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}

I agree with Jossef's answer and would add one thing.

I have an older iOS app that I've migrated up to iOS6. In my AppDelegate I originally added the main view controller like this:

 [self.window addSubview:videoController.view];

with that line, the new autoRotation selectors Jossef mentioned still don't work. You have to update the AppDelegate line to set your rootViewController like this:

 self.window.rootViewController = videoController;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM