美文网首页
强制横屏

强制横屏

作者: 小破孩丫 | 来源:发表于2016-01-25 14:17 被阅读60次

-(void)landscapeAndPortraitChange{

UIInterfaceOrientation status  = [[UIApplication sharedApplication]statusBarOrientation];

if (UIInterfaceOrientationIsPortrait(status)) {

[[UIDevice currentDevice] setValue:[NSNumber numberWithInteger:UIDeviceOrientationPortrait] forKey:@"orientation"];

[[UIDevice currentDevice] setValue:[NSNumber numberWithInteger:UIDeviceOrientationLandscapeLeft] forKey:@"orientation"];

} else{

[[UIDevice currentDevice] setValue:[NSNumber numberWithInteger:UIDeviceOrientationPortrait] forKey:@"orientation"];

}

}

相关文章

  • iOS:强制横屏的坑

    前段时间我们播放器强制横屏,项目设置允许竖屏,在手机不锁屏状态下,手机横屏会导致播放器强制横屏的时候会导致横屏失败...

  • iOS强制横屏

    iOS强制横屏

  • 强制横屏方法

    强制横屏: 方法一: 关于强制横屏看了很多文章,首先第一个方法是invocation,这个方法可以实现横屏效果,但...

  • 强制横屏

    转载自 :http://blog.csdn.net/zhaotao0617/article/details/525...

  • 强制横屏

    -(void)landscapeAndPortraitChange{UIInterfaceOrientation ...

  • 强制横屏

    1、AppDelegate里设置属性 @property(nonatomic,assign)BOOLallowLa...

  • iOS强制横屏方法之一

    //这段代码是强制产生横屏效果,通过kvo实现//强制右横屏 可以过审核-(void)viewWillAppea...

  • 横竖屏

    需求: 让push的ViewController界面强制横屏 一、配置 二、添加强制横屏方法 pragma mar...

  • iOS 屏幕旋转控制

    /** 屏幕旋转控制 allowRotateType ==(0强制竖屏,1横竖屏,2~强制横屏 )*/ (UIIn...

  • 2021-10-21

    uni-app强制横竖屏 //强制横屏 plus.screen.lockOrientation('landscap...

网友评论

      本文标题:强制横屏

      本文链接:https://www.haomeiwen.com/subject/aqxdkttx.html