我试图只支持景观。有一个新要求显示此对话框,第一次解释有关我们的应用程序的一些事情。所以在我启动的第一个视图控制器中,在viewDidLoad中,我有这个代码:
BOOL showFirstTimeUse = [[NSUserDefaults standardUserDefaults] boolForKey:@"ShowFirstTimeUse"];
if (!showFirstTimeUse) {
FirstUseViewController *tvc = [[FirstUseViewController alloc] initWithNibName:@"FirstUseViewController" bundle:nil];
tvc.modalPresentationStyle = UIModalPresentationFormSheet;
tvc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:tvc animated:YES];
[tvc release];
}
然后在FirstUseViewController中,我定义了这个:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight;
}
在IB中,我没有更改任何默认设置。我基本上只是将UIWebView放到屏幕的左上角以显示我的数据并连接到它的插座,这样我就可以轻松地显示格式化的文本。
当我现在运行我的应用程序时,此视图控制器的演示会导致我的应用程序以纵向而非横向开始。我该如何解决?感谢。
答案 0 :(得分:0)
您shouldAutorotateToInterfaceOrientation:
的实施有误;它总是会评估为真。您可能想要使用:
return UIInterfaceOrientationIsLandscape(interfaceOrientation);