【发布时间】:2014-04-01 18:49:32
【问题描述】:
表格单元格的左侧应该有 3 行文本(比如标题、名称、出生日期),右侧应该有 1 行文本大小(分数)。
自动生成行数以及每个单元格的内容。
我尝试在情节提要的原型单元格内创建带有标签的 UILabels 并填充这些标签的文本,但是只显示空单元格而没有内容。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(!cell){
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
UILabel *titleLabel = (UILabel *)[cell viewWithTag:100];
titleLabel.text = list.title;
UILabel *nameLabel = (UILabel *)[cell viewWithTag:101];
nameLabel.text = list.name;
UILabel *dobLabel = (UILabel *)[cell viewWithTag:102];
dobLabel.text = list.dob;
UILabel *scoreLabel = (UILabel *)[cell viewWithTag:103];
scoreLabel.text = list.score;
return cell;
}
我的代码有什么问题/还有其他解决方案吗?
感谢您的时间和帮助。
【问题讨论】:
标签: uitableview ios7 storyboard xcode5