如何将TableView加载到第二UIView? [英] How To Load TableView Into 2nd UIView?

查看:32
本文介绍了如何将TableView加载到第二UIView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个tableview1,在navbar中有一个添加按钮.当您按下添加按钮时,会创建一个新的uiview动画.当前新视图为空白.

I have a tableview1 that has an add button in navbar. When you press the add button, a new uiview animates in. Currently the new view is blank.

我想在新视图中有一个带有子表的表视图.按下完成按钮时,它会发出动画.

I want to have a table view with sub-table in this new view. It will animate out when the done button is pressed.

我的问题是,该第二个视图表和子表的代码应该放在哪里,我应该新建一个类还是将其保留在原始类中?

My question is, where do I put the code for this 2nd view table and sub table, do I make a new class or keep it with the original class?

想想我想做的事情,例如添加收藏夹.我有一个带有添加按钮的收藏夹列表,我想单击添加按钮并调出一个表,该表可能包含一个子表,我可以从中选择一个单元格,它将关闭该表并将该单元格添加到初始收藏夹中桌子.

Think of what I'm trying to do like adding favorites. I have a favorites list with an add button, I want to click the add button and bring up a table which may have a sub-table from which I can select a cell and it will dismiss this table and add the cell to the initial favorites table.

推荐答案

通常,您的应用中使用的每种视图控制器类型都会有一个新类.定义好视图控制器后,通常可以通过将其推到导航控制器上或通过模态显示来显示它们.

You will generally have a new class for each type of view controller in use in your app. Once you have your view controllers defined, you typically display them either by pushing onto a navigation controller or by presenting modally.

在调用添加按钮操作时,FavoritesViewController.m中的示例:

Example in FavoritesViewController.m when the add button action is invoked:

- (IBAction)addMoreFavorites
{
    AddFavoritesViewController *addFavesVC = [[[FavoritesViewController alloc] init] autorelease];

    // if using a navigation controller
    [self.navigationController pushViewController:addFavesVC];

    // if presenting modally
    [self presentModalViewController:addFavesVC];
}

要在完成后关闭 addFavesVC ,请使用 [self.navigationController popViewControllerAnimated:YES] [self dismissModalViewController]

To dismiss addFavesVC when done you either use [self.navigationController popViewControllerAnimated:YES] or [self dismissModalViewController]

有许多方法可以实现在数据模型中添加新的收藏夹并在一个或多个视图控制器中更新UI.

There are many ways to implement adding new favorites to your data model and updating the UI in one or more view controller.

这篇关于如何将TableView加载到第二UIView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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