我创建了一个仅纵向的 iphone 应用程序,即使我在旋转设备时也制作了一个支持横向方向的视图 在 iOS6 中一切正常,但是当我在 iOS5 上运行它时,横向模式不正确,它显示了一些讨厌的图像。(这两款设备都是 ipod 3.5" 视网膜显示屏)
为什么会这样??
在此处添加我的代码和屏幕截图
在 iOS6 在 iOS 5
-(void)viewDidLoad { [超级 viewDidLoad];
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(didRotate:)
name:UIDeviceOrientationDidChangeNotification
object:nil];
}
- (void)didRotate:(NSNotification *)notification {
UIDeviceOrientation orientation = [[notification object] orientation];
if (orientation == UIDeviceOrientationLandscapeLeft) {
[self.grpView setTransform:CGAffineTransformMakeRotation(M_PI / 2.0)];
imageScrollView.frame =CGRectMake(-50, -100, 400, 620);
} else if (orientation == UIDeviceOrientationLandscapeRight) {
[self.grpView setTransform:CGAffineTransformMakeRotation(M_PI / -2.0)];
} else if (orientation == UIDeviceOrientationPortraitUpsideDown) {
[self.grpView setTransform:CGAffineTransformMakeRotation(M_PI)];
} else if (orientation == UIDeviceOrientationPortrait) {
[self.grpView setTransform:CGAffineTransformMakeRotation(0.0)];
}
}