Xcode 4.5 iOS 6.0 simulator orientation not working

前端 未结 2 1281
面向向阳花
面向向阳花 2021-01-15 18:39

I have updated my Xcode to 4.5 , I have implemented the orientation methods as below

  -(BOOL)shouldAutorotate{

    return YES;

  }

-(NSUInteger)supported         


        
2条回答
  •  粉色の甜心
    2021-01-15 19:06

    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.

提交回复
热议问题