具有导航控制器和FlipSide上的表视图的实用程序 [英] Utility App with Navigation Controller and Table View on FlipSide

查看:99
本文介绍了具有导航控制器和FlipSide上的表视图的实用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对整个MVC看待事物的方式相对较新。

I am relatively new to the whole MVC way of looking at things.

我有一个基于Utility应用程序模板的应用程序。 MainView和FlipsideView中的所有内容都运行良好,但现在我需要在反面添加TableView和导航控制器。没有导航栏在MainView上。

I have an application that is based on the "Utility" Application template. Everything in the MainView and FlipsideView is working great but now I need to add a TableView and Navigation Controller to the flipside. Without the navigation bar being on the MainView.

因此,只有当用户点击信息灯按钮后,导航栏才会在桌面视图上显示。
我已经能够在侧面实现表视图并使用数组中的数据填充它。
我现在正努力在导航控制器中进行链接,以便tableview可以变为交互式。
当我将导航条形码放入应用程序委托时,它出现在MainView而不是翻转视图上。

So only once the user has tapped the info light button will the nav bar display on the flipside with a table view. I have been able to impliment the Table View on the side and populate it with data from an array. I am now struggling to link in a navigation controller so that the tableview can become interactive. When I place the nav bar code into the app delegate it appears on the MainView and not the flipside view.

我在哪里放置导航条形码它将显示在flipsideview上。我似乎无法将代码放在正确的位置。
另外我不确定我是否有正确的代码,我是否将UINavigationController代码放在FlipSideViewController.m中?

Where do I place the navigation bar code so that it will display on the flipsideview. I cannt seem to get the code in the right place. Also I am not sure I have the right code, do I put the UINavigationController code in the FlipSideViewController.m ?

我认为我并没有完全理解naivgation控制器的概念。 。 。

I am not grasping the concept of the naivgation controller fully I think . . .

以下是启动FlipView的代码

Here is the code to bring up the FlipView

- (IBAction)showInfo 
{    
 TableViewController *controller = [[TableViewController alloc] initWithNibName:@"TableViewController" bundle:nil];
 controller.delegate = self;
 controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
 [self presentModalViewController:controller animated:YES];

 [controller release];

}

现在我需要让TableViewController拥有一个导航控制器和表格视图

Now I need to get the TableViewController to have a navigation controller and a table view

提前致谢。

推荐答案

创建表视图控制器后,创建一个包含此表视图控制器的导航控制器作为根。然后,以模态方式呈现此导航控制器,而不是表视图控制器。

After you create your table view controller, create a navigation controller that contains this table view controller as the root. Then, present this navigation controller modally, instead of your table view controller.

我更喜欢以编程方式执行此操作,因此这是我使用的代码:

I prefer to do this programmatically, so here's the code I use:

- (IBAction)showInfo 
{
    TableViewController *controller = [[TableViewController alloc] initWithNibName:@"TableViewController" bundle:nil];
    controller.delegate = self;

    UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:controller];
    [controller release];

    navController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    [self presentModalViewController:navController animated:YES];
    [navController release];
}

在表格视图控制器中,设置其导航项目以包含一个按钮,当点击时,会导致主视图控制器关闭模态导航控制器(从而翻转回自身)。

In your table view controller, set up its navigation item to contain a button that, when tapped, causes your main view controller to dismiss the modal navigation controller (thus flipping back to itself).

这篇关于具有导航控制器和FlipSide上的表视图的实用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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