博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ios7(自动旋屏)iOS6不支持shouldAutorotateToInterfaceOrientation
阅读量:4198 次
发布时间:2019-05-26

本文共 1056 字,大约阅读时间需要 3 分钟。

参考开源中国——双子座教程ios7

发现 b2c交易在ios6上webview随屏幕旋转了,但是b2c支持横屏的,原因是ios6的委托

iOS6下的

- (BOOL)shouldAutorotateToInterf
aceOrientation:(UIInterfaceOrientation)toInterfaceOrientation

{

 
 
 
  
 
 return UIInterfaceOrientationIs
Landscape(toInterfaceOrientation);

}


这个不会再被调用,取而代之的是这俩个组合:

- (BOOL)shouldAutorotate

{

 
 
 return YES;

}

 

- (NSUInteger)supportedInterfaceOrient
ations

{

 
 
 
 return UIInterfaceOrientationMa
skLandscape;

}


当然,为了保持对旧版本系统行为的兼容性,不要删掉不用的那个调用。另外还有一个这个preferred朝向也可以加上

- (UIInterfaceOrientation)preferredInterfaceOrient
ationForPresentation

{

 
 
 
 return UIInterfaceOrientationLa
ndscapeRight;

}

b2c交易只支持横屏,网银交易需要支持横竖屏,所以如果在info.plist设置支持的方向,则再同以客户端下两种应用有冲突。解决这个问题的方法就是再前面的基础上再应用的delegate中加入如下回调:

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
    if (clientstate == 0) 
        return UIInterfaceOrientationMaskAll;
    else
        return UIInterfaceOrientationMaskLandscape;
}

简单说明:

UIInterfaceOrientationMaskLandscape  支持左右横屏

UIInterfaceOrientationMaskAll  支持四个方向旋转
UIInterfaceOrientationMaskAllButUpsideDown 支持除了UpsideDown以外的旋转

转载地址:http://lgwli.baihongyu.com/

你可能感兴趣的文章
FFmpeg编译支持AV1编解码器libaom-av1
查看>>
linux下编译libaom-av1
查看>>
python发送smtp电子邮件
查看>>
python自动发送短信验证码、短信通知、营销短信、语音短信
查看>>
python 日志打印模块,输出时间、文件名、行号信息等
查看>>
什么是云计算(公有云、私有云、混合元、IAAS、PAAS、SAAS、虚拟化)
查看>>
什么是云原生
查看>>
如何生成通用唯一识别码UUID
查看>>
ffmpeg实现水平翻转与垂直翻转vflip与hflip
查看>>
Python定时任务框架apscheduler,定时执行多个固定任务
查看>>
python定义一个装饰器自动测量函数的运行时间
查看>>
语义化版本管理(Semantic Versioning)
查看>>
ImportError: cannot import name 'imread'
查看>>
python处理ctype模块的输出日志
查看>>
ffmpeg时间戳精准定位
查看>>
ffmpeg Could not find module pixeliz0r
查看>>
OpenCV保存视频的格式FourCC
查看>>
ffmpeg实现马赛克像素化
查看>>
linux 下编译安装 opencv-python
查看>>
使用ssh公钥登录Linux服务器,免重复登录
查看>>