更改 UISplitView 内的 RootViewController

发布于 2024-11-16 14:43:19 字数 437 浏览 2 评论 0原文

我正在通过 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

滥情空心 2024-11-23 14:43:19

您需要将 modalPresentationStyle 设置为适当的值,

controlador.modalPresentationStyle = UIModalPresentationCurrentContext;

UIModalPresentationCurrentContext 指示视图控制器以模态方式显示在 rootViewController 的框架内。

You need to set the modalPresentationStyle to an appropriate value,

controlador.modalPresentationStyle = UIModalPresentationCurrentContext;

UIModalPresentationCurrentContext instructs the view controller to appear modally within the frame of the rootViewController.

宣告ˉ结束 2024-11-23 14:43:19

使用 pushViewController:animated 可能会解决这个问题。关于 ModalViewController,请查看文档 http://developer.apple.com /library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/ModalViewControllers/ModalViewControllers.html

Use pushViewController:animated instead may fix this. About ModalViewController, check document http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/ModalViewControllers/ModalViewControllers.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文