iphone应用程序中禁止屏幕自动旋转 自定义屏幕旋转

来源:互联网 发布:ubuntu默认安装路径 编辑:程序博客网 时间:2024/04/30 14:33
 在summary中的 supported devices orientation中设置所支持的屏幕旋转方式在实际RUN时并不会应用所选项目,正确的禁止屏幕旋转方向以及自定义屏幕旋转方式要在viewcontrol.m文件中的

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 方法中作适当的更改

默认是禁止

 UIInterfaceOrientationPortraitUpsideDown

如果你只需显示

UIInterfaceOrientationPortrait 则可以使用 if else 语句来作相应的更改

for example :

   

 if (interfaceOrientation == UIInterfaceOrientationPortrait) {

        return YES;

    }else {

        return NO;

    }

 方式二: 删除这个方法....- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 

   

原创粉丝点击