@interface ios_t017_tableview_1_basicViewController : UIViewController<UITableViewDataSource>
本类实现了UITableViewDataSource,此协议有一下方法:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
return cell;
}
本文介绍了一个简单的iOS应用中TableView的基本实现方法。通过继承UIViewController并遵守UITableViewDataSource协议, 实现了单节单行的基础TableView展示。具体包括返回TableView的节数、每节的行数以及为每个单元格提供配置。

被折叠的 条评论
为什么被折叠?



