- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *cellIdentify = @"MyTableViewCellIdentity";
MyTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentify];
if (!cell) {
[tableView registerNib:[UINib nibWithNibName:@"MyTableViewCell" bundle:nil] forCellReuseIdentifier:cellIdentify];
cell = [tableView dequeueReusableCellWithIdentifier:cellIdentify];
}
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 80.0;
}
本文介绍了一个UITableView中单元格(MyTableViewCell)的配置方法,包括单元格的重用及初始化过程,并设置了每个单元格的高度为80.0。这对于理解UITableView的数据展示逻辑及其高度自定义非常有帮助。
889

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



