Tag: ios6 autorotate

在iOS6下多个xib旋转的问题

我需要为纵向和横向使用不同的xib文件。 我没有使用自动布局,但我使用iOS6。 (见我以前的问题,如果你在乎为什么。) 我跟随亚当的回答这个问题修改与amergin的initWithNib名字把戏,修改与我自己的iPhone / iPad的需要。 这是我的代码: -(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { [[NSBundle mainBundle] loadNibNamed:[self xibNameForDeviceAndRotation:toInterfaceOrientation] owner: self options: nil]; [self viewDidLoad]; } – (NSString *) xibNameForDeviceAndRotation:(UIInterfaceOrientation)toInterfaceOrientation { NSString *xibName ; NSString *deviceName ; if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { deviceName = @"iPad"; } else { deviceName = @"iPhone"; } if( UIInterfaceOrientationIsLandscape(toInterfaceOrientation) ) { xibName = [NSString stringWithFormat:@"%@-Landscape", […]

防止一个视图控制器autorotate?

我的应用程序可以自动旋转,但我需要其中的一个意见,只能在肖像模式下显示,不知道如何实现这一点。 我尝试了这个(除其他外),但是有问题的视图仍然在旋转: // ViewController.m -(BOOL)shouldAutorotate { return NO; } – (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait; } 有人能指出我做错了什么吗? 谢谢。 -编辑- 这是iOS 6.1

如何使应用程序完全正确工作在iOS 6自动旋转?

在iOS6中,不推荐使用shouldAutorotateToInterfaceOrientation。 我试图使用supportedInterfaceOrientations和shouldAutorotate使应用程序正常自动旋转,但失败。 这个ViewController我不想旋转,但它不工作。 – (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationPortrait); } -(BOOL)shouldAutorotate { return NO; } -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait; } 有任何想法吗? 提前感谢您的帮助!