iOS 5.1和iOS 6的轮换兼容性

iOS 5.1和iOS 6的轮换兼容性,ios,rotation,universal,Ios,Rotation,Universal,在一个需要同时在iOS 5.1和iOS 6.0上运行的通用应用程序中,我使用上述代码在两个版本中以及在iPhone和iPad上允许旋转。 有没有更好的方法来做到这一点,同时保持两个版本之间的兼容性,并且不使用不推荐使用的函数? 有了上面的代码,我在使用iOS 6.0的iPad上遇到了一些小问题,有时 多谢各位 // Override to allow orientations other than the default portrait orientation. // Rotation for

在一个需要同时在iOS 5.1和iOS 6.0上运行的通用应用程序中,我使用上述代码在两个版本中以及在iPhone和iPad上允许旋转。 有没有更好的方法来做到这一点,同时保持两个版本之间的兼容性,并且不使用不推荐使用的函数? 有了上面的代码,我在使用iOS 6.0的iPad上遇到了一些小问题,有时

多谢各位

// Override to allow orientations other than the default portrait orientation.
// Rotation for v. 5.1.1
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
    // on iPad support all orientations
    return YES;
    }
else {
    // on iPhone/iPod support all orientations except Portrait Upside Down
    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
    }
return NO;
}



// Rotation 6.0

// Tell the system It should autorotate
- (BOOL) shouldAutorotate {
return YES;
}

// Tell the system which initial orientation we want to have
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return UIInterfaceOrientationPortrait;

}

// Tell the system what we support
-(NSUInteger)supportedInterfaceOrientations
 {
// return UIInterfaceOrientationMaskLandscapeRight;
// return UIInterfaceOrientationMaskAll;
return UIInterfaceOrientationMaskAllButUpsideDown;
}
加: 经过一些测试后,我在模拟器中再次发现了这个错误:slitViewController的左侧部分由于上述错误而变黑(不总是如此)(然后再次运行,旋转iPad):


:CGImageCreate:无效的图像大小:0 x 0。
:CGContextSetFillColorWithColor:无效上下文0x0
:CGContextSetStrokeColorWithColor:无效上下文0x0
:CGContextGetCompositeOperation:无效的上下文0x0
:CGContextSetCompositeOperation:无效的上下文0x0
:CGContextFillRects:无效的上下文0x0



使用iOS6的iPad有哪些问题?当在iOS6上运行时,不推荐的方法不应该做任何事情;有一次(横向中的iPad)左侧部分(SplitViewController中的表视图,与纵向中的popover相对应)显示为全黑色(然后旋转iPad再次出现)……这是在设备、模拟器上还是两者上发生的?同样在模拟器中:在我编辑它时,请参见上面的消息,您解决了吗?我也有同样的问题
<Error>: CGImageCreate: invalid image size: 0 x 0.
<Error>: CGContextSetFillColorWithColor: invalid context 0x0
<Error>: CGContextSetStrokeColorWithColor: invalid context 0x0
<Error>: CGContextGetCompositeOperation: invalid context 0x0
<Error>: CGContextSetCompositeOperation: invalid context 0x0
<Error>: CGContextFillRects: invalid context 0x0