我创建了一个以模态视图启动页面开头的拆分视图应用程序.问题是模态视图总是以纵向模式启动,即使ipad处于横向模式.如果我旋转ipad几次,它会适当旋转.我在Info.plist中设置了UIInterfaceOrientation,但它没有任何影响.
在didFinishLaunchingWithOptions中,我使用以下代码
...
[self.window addSubview:splitViewController.view];
SplashViewController *modalView = [[SplashViewController alloc] intiWithNibName:nil bundle:nil];
modalView.modalPresentationStyle = UIModalPresentationFullScreen;
[splitViewController presentModalViewController:modalView animated:YES];
...
关于如何确保模态视图在景观中启动的任何建议?
最佳答案 我认为这是更好的方法:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation==UIInterfaceOrientationLandscapeRight) {
return YES;
}
return NO;
}