iOS   发布时间:2022-03-30  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了IOS 6的自动旋转问题大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

iOS 6的rotation改变了很多。先来看看官方的描述  http://www.bgr.com/2012/08/06/ios-6-beta-4-change-log-now-available/


知识点:

*UIViewController的shouldAutorotateToInterfaceOrientation方法被deprecated。在ios6里,是使用supportedInterfaceOrientations and shouldAutorotate 2个方法来代替shouldAutorotateToInterfaceOrientation。注意:为了向后兼容iOS 4 and 5,还是需要在你的app里保留shouldAutorotateToInterfaceOrientation。

for ios 4 and 5,如果没有重写shouldAutorotateToInterfaceOrientation,那么对于iphone来讲,by default是只支持portrait,不能旋转。

for ios 6,如果没有重写shouldAutorotate and supportedInterfaceOrientations,by default,iphone则是"可以旋转,支持非upside down的方向",而ipad是"可以选择,支持所有方向"


example 1: for ios 4 and 5,iphone device,若要"可以旋转,支持非upside down的方向",则可以在view controller里

[cpp]  view plain copy
  1. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {  
  2. return (interfaceOrientation != UIDeviceOrientationPortraitUpsideDown);  
  3. }  

example 2: for ios 6,若要“不能旋转,只支持portait",则可以在view controller里

copy

大佬总结

以上是大佬教程为你收集整理的IOS 6的自动旋转问题全部内容,希望文章能够帮你解决IOS 6的自动旋转问题所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: