How to force a UIViewController to Portrait orientation in iOS 6

后端 未结 16 1553
别那么骄傲
别那么骄傲 2020-11-22 06:03

As the ShouldAutorotateToInterfaceOrientation is deprecated in iOS 6 and I used that to force a particular view to portrait only, what is the c

16条回答
  •  眼角桃花
    2020-11-22 06:44

    IOS 5

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

    IOS 6

    -(BOOL)shouldAutorotate{
        return YES;
    }
    
    -(NSInteger)supportedInterfaceOrientations{
    
        //    UIInterfaceOrientationMaskLandscape;
        //    24
        //
        //    UIInterfaceOrientationMaskLandscapeLeft;
        //    16
        //
        //    UIInterfaceOrientationMaskLandscapeRight;
        //    8
        //
        //    UIInterfaceOrientationMaskPortrait;
        //    2
    
        //    return UIInterfaceOrientationMaskPortrait; 
        //    or
              return 2;
    }
    

提交回复
热议问题