大佬教程收集整理的这篇文章主要介绍了ios – 在cordova 3.5.0中iPhone屏幕方向没有变化,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
当我转动它时,如何在iPhone中更改我的应用程序屏幕方向?
<preference name="Orientation" value="default" />
我能找到的唯一解决方案是在Cordova代码中的MainViewController.m中更改方法shouldAutorotateToInterfaceOrientation:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations -- return [super shouldAutorotateToInterfaceOrientation:interfaceOrientation]; ++ return true; }
但这对我来说似乎是一个丑陋的解决方案,我真的很想找到正常的做法.
理想情况下,除了porTraitUpsideDown之外,iPad和iPhone的所有方向都是好的,但我不知道我是否被允许梦想它.
还有其他人与iPhone和Cordova有类似的问题吗?我一直在谷歌搜索几天,除了这个黑客在cordova代码中找不到任何东西.
<preference name="Orientation" value="default" />
代码应该实际更改iOS配置文件(/platform/ios/~app_name〜/〜app_name〜.plist)中的平台UISupportedInterfaceOrientations键,以包含以下值:
>“UIInterfaceOrientationLandscapeLeft”;
>“UIInterfaceOrientationLandscapeRight”;
>“UIInterfaceOrientationPorTrait”; (我认为)
>“UIInterfaceOrientationPorTraitUpsideDown”
不幸的是,更改config.xml文件不会改变plist文件,这很烦人.希望这将很快得到排序,从在线发现的线程判断,很多人浪费时间寻找解决方案.
我发现最简单的解决方案是手动更改~app_name~.plist文件以包含上面的值.我一直在xcode中这样做,这很容易做到.
希望这可以帮助.如果有更好的解决方案或Cordova修复此疏忽请告诉我.
以上是大佬教程为你收集整理的ios – 在cordova 3.5.0中iPhone屏幕方向没有变化全部内容,希望文章能够帮你解决ios – 在cordova 3.5.0中iPhone屏幕方向没有变化所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。