Supporting both iOS 6 and iOS 5 autorotation

后端 未结 6 1375
-上瘾入骨i
-上瘾入骨i 2020-12-06 05:46

Can anyone confirm that to support both iOS 6 and iOS 5 there is no point to adding the new iOS 6 autorotation methods, since the Apple docs suggest that these methods are c

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-06 06:23

     - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
    {
        return UIInterfaceOrientationMaskAll;
    }
    
    -(void)viewWillLayoutSubviews
    {
    if([self interfaceOrientation] == UIInterfaceOrientationPortrait||[self interfaceOrientation] ==UIInterfaceOrientationPortraitUpsideDown)
        {
           if (screenBounds.size.height == 568)
            {
              //set the frames for 4"(IOS6) screen here
             }
            else
    
            {
             ////set the frames for 3.5"(IOS5/IOS6) screen here
            }
    
    }
            else if ([self interfaceOrientation] == UIInterfaceOrientationLandscapeLeft||[self interfaceOrientation] == UIInterfaceOrientationLandscapeRight)
            {
             if (screenBounds.size.height == 568)
            {
              //set the frames for 4"(IOS6) screen here
             }
            else
    
            {
             ////set the frames for 3.5"(IOS5/IOS6) screen here
            }
    
    
        }
    //it is for IOS5
     - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
        {
         return YES;
        }
    

    -(void)viewWillLayoutSubviews this method will call for ios5/ios6. this code is usefull to both ios6/ios5/ios6 with 3.5" screen/4" screen with ios6.

提交回复
热议问题