在新的ios 5.1 UISplitViewController中,presentViewController:animated:completion显示问题 [英] presentViewController:animated:completion display issues in new ios 5.1 UISplitViewController
问题描述
使用UISplitViewController
和presentViewController:animated:completion
遇到了一些问题.
I've ran into some problems using UISplitViewController
with presentViewController:animated:completion
.
为了将问题分解为最简单的形式,我创建了一个带有master/detail模板的简单项目.在项目中,我在主视图的导航栏中添加了+
按钮.加号按钮创建一个带有简单空白视图的导航控制器.然后使用presentViewController:animated:completion
呈现此导航控制器.但是,显示的视图仅显示在主视图中,当您将其关闭时,主视图会占据整个屏幕.我似乎无法理解发生了什么.还有其他人遇到这个问题吗?这是代码.
To break the problem down into its simplest form, I've created a simple project with the master/detail template. In the project I've added a +
button in the navigation bar of the master view. The plus button creates a navigation controller with a simple blank view. This navigation controller is then presented using presentViewController:animated:completion
. However, the presented view only displays in the master view and when you dismiss it, the master view takes up the whole screen. I can't seem to understand what is going on. Anyone else encountered this problem? Here's the code.
- (void)showViewController:(id)sender
{
LMTestViewController *masterView = [[LMTestViewController alloc] init];
[self presentViewController:masterView animated:YES completion:nil];
[masterView release];
}
感谢您的帮助.
推荐答案
要模态显示,请使用窗口的根视图控制器.使用其他任何东西都会使事物在拆分视图中变得混乱,尤其是在旋转等情况下.
To present modally, use the window's root view controller. Using anything else will cause things to become confused in the split view, especially when rotating, etc.
[self.view.window.rootViewController presentViewController:masterView
animated:YES
completion:NULL];
这篇关于在新的ios 5.1 UISplitViewController中,presentViewController:animated:completion显示问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!