在另一个ViewController的视图中显示整个ViewController [英] Display whole ViewController within another ViewController's view

查看:97
本文介绍了在另一个ViewController的视图中显示整个ViewController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个主视图控制器为UIViewController的应用程序.它在网格中有一些图标,当我单击其中一个图标时,我想关闭该网格(向下滑动).我已经做完了.问题是:关闭网格后,我希望另一个视图从屏幕顶部出现.该视图位于该相同的根视图控制器中.但是我想在此视图中显示其他视图控制器的内容.例如:我希望该视图在其中显示UINavigationController并带有UITableView,以便用户可以浏览TableViews.

Im writing an application which the main view controller is a UIViewController. It has some icons in a grid and I want to dismiss (sliding down) this grid when one of the icons is clicked. This I've done already. The problem is: when the grid is dismisseed I want another View to come from the top of the screen. This view is in this same root view controller. But I want to display the content of other view controllers in this view. For example: I want this view to show a UINavigationController with a UITableView inside it, so the user can navigate through TableViews.

我正在这样做:

HorariosViewController *horarios = [[HorariosViewController alloc] init];
[vuashView addSubview:horarios.view];

HorariosViewControllerUINavigationViewController.它只显示蓝色的NavigationBar,而self.navigationItem.title = @"Title"之类的更改将不起作用.

HorariosViewController is a UINavigationViewController. It shows me only a blue NavigationBar and changes like self.navigationItem.title = @"Title" won't work.

谢谢!

推荐答案

一种方法是已经有导航控制器,图标网格以模态形式显示在其顶部. (您可以通过这种方式在没有动画的情况下设置视图,因此用户不会在下面看到导航控制器.)

One approach is to have the navigation controller already there, with the icon grid presented modally on top of it. (you can set the view up this way without animations, so the user doesn't see the navigation controller underneath).

然后,当网格消失时,它可以使用动画对其自身调用dismissModalViewController.

Then, when it's time for the grid to go away, it can call dismissModalViewController on itself with animation.

这篇关于在另一个ViewController的视图中显示整个ViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆