从模态视图推送视图

发布于 2024-10-14 00:57:42 字数 419 浏览 2 评论 0原文

我试图从我的模态视图中推动一些视图。我正在尝试做与其他观点相同的事情。但问题是,我认为,模态视图没有导航控制器。

CadastroViewController *vaiCadastro = [[[CadastroViewController alloc] initWithNibName:
                                        NSStringFromClass([CadastroViewController class]) bundle:nil] autorelease];

[self.navigationController presentModalViewController:vaiCadastro animated:YES];

我可以做什么来将另一个视图推入我的模态视图中?

谢谢!

im trying to push some view from my modal view. Im trying doing the same things that i do on other views. But the problem is, i think, thats the modalview doesnt have a navigation controller.

CadastroViewController *vaiCadastro = [[[CadastroViewController alloc] initWithNibName:
                                        NSStringFromClass([CadastroViewController class]) bundle:nil] autorelease];

[self.navigationController presentModalViewController:vaiCadastro animated:YES];

What can i do to push another view inside of my modal view?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

翻了热茶 2024-10-21 00:57:42

@Lucas Veiga 在这种情况下你必须创建导航控制器的对象...并且你将得到导航栏,原因是 modalview 没有导航控制器

CadastroViewController *vaiCadastro = [[[CadastroViewController alloc] initWithNibName:
                                        NSStringFromClass([CadastroViewController class]) bundle:nil] autorelease];

    UINavigationController *navController = [[[UINavigationController alloc]
                                              initWithRootViewController:vaiCadastro] autorelease];

    [self.navigationController presentModalViewController:navController animated:YES];

祝你好运!

@Lucas Veiga you have to make the object of navigation controller in this case...and you will get the navigationBar the reason is modalview doesnt have a navigation controller

CadastroViewController *vaiCadastro = [[[CadastroViewController alloc] initWithNibName:
                                        NSStringFromClass([CadastroViewController class]) bundle:nil] autorelease];

    UINavigationController *navController = [[[UINavigationController alloc]
                                              initWithRootViewController:vaiCadastro] autorelease];

    [self.navigationController presentModalViewController:navController animated:YES];

Good luck!

維他命╮ 2024-10-21 00:57:42

“但问题是,我认为模态视图没有导航控制器。”

是的,模态视图控制器没有导航控制器,除非您创建一个导航控制器并将其添加到模态视图控制器。然后就可以了。

顺便说一句,您可能想知道模态视图控制器及其父控制器是否可以共享导航控制器,答案是否定的,您需要创建单独的导航控制器用于推送和弹出不同的控制器层次结构。

"But the problem is, i think, thats the modalview doesnt have a navigation controller."

Yes, the modal view controller doesn't have a nav controller UNLESS you create one and add it to the modal view controller. Then it'll work.

Btw, you may wonder whether the modal view controller and its parent controller can share a nav controller or not, well, the answer is no, you need to create separate nav controllers for pushing-and-popping at different controller hierarchies.

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