如何在View Controller中管理UI Table View [英] How to manage UI Table View in View Controller

查看:52
本文介绍了如何在View Controller中管理UI Table View的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的UI视图,其中包含一些项。我想在其中放置一个表格视图。

I've got a simple UI View, with some items in it. I'd like to place in it a Table View.

有人可以通过简单的步骤向我解释我必须写什么才能对其进行管理吗?

Can anybody explain me with easy steps what do I have to write in order to manage it?

我还有另一个UITableView,其中包含元素,行等。问题是在UI视图中实现TableView:我不知道如何从那里添加行等。

I have another UITableView with elements in it, rows etc. The problem is implementing a TableView in a UI View: I don't know how to add rows etc from there.

我尝试执行以下操作,但未成功:

I tried, with no success, to do the following:

@interface SecondViewController : UIViewController <UITableViewDelegate> {
UITextField     *indirizzo;
NSMutableData   *data;
UIButton *compra;

然后在.m文件中实现

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 10;
}

但是表格没有改变。

推荐答案

如果想向UITableView添加行,则需要声明UIViewController为tableView DataSource (不委托)。 (代表其他内容)

Well for start if you want to add rows to a UITableView you need to declare your UIViewController as the tableView DataSource not delegate. (delegate is for other stuff)

您应该查看表格视图编程指南

这篇关于如何在View Controller中管理UI Table View的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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