现在的位置: 首页 > 综合 > 正文

项目启动 摆放横屏或竖屏 转屏项目不变

2014年03月22日 ⁄ 综合 ⁄ 共 570字 ⁄ 字号 评论关闭

项目启动 摆放横屏或竖屏  转屏项目不变

 - 固定其呈现方向 -

1 首先选择支持的旋转方向:

2 在启动页面添加限制:


上面的只能显示一个方向

下面的代码限制为横屏正着和倒着

- (BOOL)shouldAutorotate

{

    return
YES;

}

- (NSUInteger)supportedInterfaceOrientations

{

    [self
shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationMaskLandscapeLeft |
UIInterfaceOrientationMaskLandscapeRight];

    return
UIInterfaceOrientationMaskLandscapeLeft |
UIInterfaceOrientationMaskLandscapeRight;

}

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

{

    if (UIInterfaceOrientationIsLandscape(interfaceOrientation)) {

       
return YES;

    }else{

       
return NO;

    };

}

抱歉!评论已关闭.