我的应用程序不能在iOS 6 GM模拟器中自动旋转,但它可以在设备上使用相同版本的iOS。这会不会是模拟器的bug?这个应用使用的是过时的自动旋转方法,但它们在设备本身上工作得很好,这让我想知道模拟器app是否有所不同?
发布于 2012-09-13 22:04:01
这是我为了让我的应用程序再次工作而添加的:
// Tell the system what we support
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAllButUpsideDown;
}
// Tell the system It should autorotate
- (BOOL) shouldAutorotate {
return YES;
}
// Tell the system which initial orientation we want to have
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return UIInterfaceOrientationPortrait;
}发布于 2012-09-27 21:34:28
它应该仍然适用于弃用的rotate方法,但您需要将以下内容添加到didFinishLaunchingWithOptions:方法中:
self.window.rootViewController = yourRootViewController;这将告诉主window将旋转通知发送到哪个视图控制器。这是iOS 6.0SDK中的新特性。
发布于 2012-09-27 02:06:03
添加以下内容不足以使其在模拟器上工作:
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAllButUpsideDown;
}
- (BOOL) shouldAutorotate {
return YES;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return UIInterfaceOrientationPortrait;
}为了使其正常工作,我还在appDelegate类的didFinishLaunchingWithOptions函数中添加了以下内容:
self.window.rootViewController = viewController;在此添加之后,我停止了收到以下错误:在应用程序启动结束时,应用程序窗口应该有一个根视图控制器
https://stackoverflow.com/questions/12406748
复制相似问题