【发布时间】:2012-11-27 20:48:08
【问题描述】:
对于我的应用,我想让设备旋转,但要上下颠倒。这工作正常。但是,我想阻止应用程序专门从
旋转横向左侧 -> 右侧横向 - 反之亦然
如果有人好奇,这是因为旋转会打乱我的布局,因为它们每个都从一个公共点旋转
我认为可行的 iOS 5 代码如下:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
NSLog(@"Rotating");
if((lastOrient == 3 && toInterfaceOrientation == 4) || (lastOrient == 4 && toInterfaceOrientation == 3)){
lastOrient = toInterfaceOrientation;
return NO;
}
lastOrient = toInterfaceOrientation;
return YES;
}
其中 3= 左侧横向,4= 右侧横向
关于如何使用 iOS6 执行此操作有什么建议吗?还是完全不同的解决方案?
【问题讨论】:
标签: iphone ios ios6 autorotate