开发者社区> 问答> 正文

ipad 应用 锁定lanscape状态不变,无论怎么旋转,如何实现

试过了下面两个方法都无效

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 

{ 

return UIInterfaceOrientationIsLandscape(interfaceOrientation);

}
还有

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

展开
收起
a123456678 2016-07-19 17:14:33 1803 0
1 条回答
写回答
取消 提交回答
  • <key>UISupportedInterfaceOrientations</key>
        <array>
            <string>UIInterfaceOrientationLandscapeLeft</string>
        </array>
    或者代码中viewcontroller加,
    
    - (BOOL)shouldAutorotate
    {
        return NO;
    }
    
    - (NSUInteger)supportedInterfaceOrientations
    {
        return UIInterfaceOrientationMaskLandscapeRight;
    }
    
    - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
    {
        return UIInterfaceOrientationLandscapeRight;
    }
    
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    {
        return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
    }
    2019-07-17 19:58:36
    赞同 展开评论 打赏
问答分类:
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
事务、全局索引、透明分布式 立即下载
低代码开发师(初级)实战教程 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载