Iva*_*iaz 4 xcode autorotate ios5 ios6 xcode4.5
我已经制作了针对iOS 5和iOS 6的应用程序,出于某种原因,它仅在iOS 6设备上使用时才会旋转,在iPhone或iPad上使用它,并且不会在使用iOS 5的设备上旋转.我的应用程序是普遍的.请帮我解决这个问题!谢谢
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return ((toInterfaceOrientation == UIInterfaceOrientationPortrait) || (toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown));
}
- (NSUInteger)supportedInterfaceOrientations
{
return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown);
}
Run Code Online (Sandbox Code Playgroud)
在你的所有uiviewcontroller子类中覆盖这两个方法......这将适用于ios 6及更早版本
iOS 5和iOS 6调用不同的方向和旋转代理.在iOS 5中,实现:
shouldAutorotateToInterfaceOrientation:,在iOS 6中已弃用.
因此,在iOS 6中,确保设置了根视图控制器,并实现:
shouldAutorotate:,supportedInterfaceOrientations和supportedInterfaceOrientationsForWindow:
| 归档时间: |
|
| 查看次数: |
4660 次 |
| 最近记录: |