Xcode UITableViewController和MainViewController

时间:2014-06-23 05:34:29

标签: objective-c xcode uitableview

我的应用有问题。我有故事板,它有类MainViewController。在我创建类domainListController<之后,我添加了UITableView。的UITableViewController。但我不知道如何使用domainListController分配我的UITableView。你能帮助我吗?

1 个答案:

答案 0 :(得分:0)

在新项目中,有一个viewController,在其中添加tableview。

现在在tableView中添加一个tableViewCell。

然后在ViewController名称后面的.h中添加UITableViewDataSource和UITableViewDelegate

yourViewController:UIViewController**<UITableViewDataSource, UITableViewDelegate>**

现在在ViewDidLoad

yourTableViewName.dataSource = self;
yourTableViewName.delegate = self;

现在你必须实现tableView的三个委托方法。

每当您想要更新数据时

[yourTableViewName reloadData];