从 iOS6 开始,我在旋转方面遇到了很大的问题。我实现了所有新的旋转方法(shouldAutorotate、preferredInterfaceOrientationForPresentation、supportedInterfaceOrientation),但所有视图仍在旋转。有趣的是,视图保持它们的大小,而窗口的其余部分(在景观中)是黑色的。
这就是我实现它的方式,有什么问题吗?
#pragma mark -
#pragma mark - InterfaceOrientation iOS 5
//Deprecated in iOS 6
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
#pragma mark -
#pragma mark - InterfaceOrientation iOS 6
- (BOOL)shouldAutorotate{
return NO;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
return UIInterfaceOrientationPortrait;
}
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskPortraitUpsideDown;
}
谢谢你们的帮助。