更改 UISplitView 内的 RootViewController
我正在通过 UISplitView XCode 模板为 iPad 开发一个小示例。它由窗口左侧显示的根控制器和右侧显示的详细视图组成。
我想要实现的目标非常简单(至少我这么认为),但我在文档中找不到实现它的方法。
我想用新控制器替换根控制器(固定在左侧)(例如,作为对按下按钮时启动的事件的响应)。我已经尝试过:
ColorPicker *controlador = [[ColorPicker alloc] initWithNibName:nil bundle:nil];
[self.rootViewController presentModalViewController:controlador animated:YES];
[controlador release];
发生的情况是新推送的控制器填充了整个窗口,而我想要的是固定在左侧,并具有开头的两列格式。
I'm developing a little example for iPad from a UISplitView XCode Template. It's formed by a root controller which is shown in the left of the window and a detail view which is shown in the right.
What I want to achieve is very simple (at least I think so) but I can't find in the documentation the way to do it.
I'd like to substitute the root controller (which appears fixed in the left) with a new controller (for example as response to a event launched when you push a button). I've tried this:
ColorPicker *controlador = [[ColorPicker alloc] initWithNibName:nil bundle:nil];
[self.rootViewController presentModalViewController:controlador animated:YES];
[controlador release];
What happens with that is that the new pushed controller fills the entire window, whereas what I want is that appears fixed at the left with the two columns format that were at the beginning.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要将
modalPresentationStyle
设置为适当的值,UIModalPresentationCurrentContext
指示视图控制器以模态方式显示在rootViewController
的框架内。You need to set the
modalPresentationStyle
to an appropriate value,UIModalPresentationCurrentContext
instructs the view controller to appear modally within the frame of therootViewController
.使用
pushViewController:animated
可能会解决这个问题。关于 ModalViewController,请查看文档 http://developer.apple.com /library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/ModalViewControllers/ModalViewControllers.htmlUse
pushViewController:animated
instead may fix this. About ModalViewController, check document http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/ModalViewControllers/ModalViewControllers.html