Xcode 4.5 iOS 6.0 simulator orientation not working

二次信任 提交于 2019-12-01 12:07:26

Apple does not call the shouldAutorotatetoInterfaceOrientation call in IOS 6.0 unless you tell the main window which view controller to send it to.

I got rotation to work in my app by setting the window.rootViewController to the top level view controller of my app in

-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
   ...
   window.rootViewController = topLevelViewController;
   ...
}

The iPhone version of my app only supports the two portrait orientations, so my top iPhone view controller required a new method:

- (NSUInteger)supportedInterfaceOrientations 
{
  return  UIInterfaceOrientationMaskPortrait |  
          UIInterfaceOrientationMaskPortraitUpsideDown;
}

here is a discussion on Buzz Touch.

Saad

Apple has deprecated shouldautorate method from ios6 use these methods instead

- (BOOL)shouldAutorotate NS_AVAILABLE_IOS(6_0);
- (NSUInteger)supportedInterfaceOrientations NS_AVAILABLE_IOS(6_0);
// Returns interface orientation masks.
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation NS_AVAILABLE_IOS(6_0);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!