项目中想要实现大部分页面保持(只支持)竖屏,单个页面保持(只支持)横屏,实现?

来源:互联网 发布:数据库系统概论考试题 编辑:程序博客网 时间:2024/05/03 13:06
建立一个单例工具类,带有一个flag属性。里面实现一个类似方法:
- (UIInterfaceOrientationMask)interfaceOrientationMask {
    if (self.flag == 1) {
        return UIInterfaceOrientationMaskLandscape;
    }else {
        return UIInterfaceOrientationMaskPortrait;
    }
}
appDelegate里实现application:supportedInterfaceOrientationsForWindow:方法,直接返回这个方法就可以了。

需要横屏的地方把单例的flag改成1,这个页面撤销的时候改回0。


0 0