整个应用里,希望只有特定的一个controller横屏,其他都竖屏,怎么设置?有的说用原来的方法,审核会不通过的

解决方案 »

  1.   

    首先在这个viewContoller里面设定只支持横向
    //iOS 7 above
    -(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
    {
        return UIInterfaceOrientationLandscapeLeft;
    }- (NSUInteger)supportedInterfaceOrientations
    {
      return UIInterfaceOrientationMaskLandscape;
    }
      

  2.   

    static int isFullScreen; //   1 == 全屏  3 == 竖屏if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)]) {
                
                SEL selector = NSSelectorFromString(@"setOrientation:");
                
                NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[UIDevice instanceMethodSignatureForSelector:selector]];
                
                [invocation setSelector:selector];
                
                [invocation setTarget:[UIDevice currentDevice]];
                
                
                NSLog(@"-%d-",isFullScreen);
                
                [invocation setArgument:&isFullScreen atIndex:2];
                
                [invocation invoke];
                
            }项目设置只允许竖屏   想要在哪个控制器切换屏幕方向就复制我上面的代码   
      

  3.   

    http://blog.csdn.net/u013068862/article/details/52911484
    这个可以用