Uitableview 使用故事板自定义表格单元格
表格单元格的左侧应该有3行文字,比如标题、名称、dob,右侧的尺寸分数应该有一行文字 自动生成行数以及每个单元格的内容 我尝试在故事板中的原型单元格内创建带有标记的UILabels,并填充这些标签的文本,但是只有空单元格显示,没有内容Uitableview 使用故事板自定义表格单元格,uitableview,ios7,storyboard,xcode5,Uitableview,Ios7,Storyboard,Xcode5,表格单元格的左侧应该有3行文字,比如标题、名称、dob,右侧的尺寸分数应该有一行文字 自动生成行数以及每个单元格的内容 我尝试在故事板中的原型单元格内创建带有标记的UILabels,并填充这些标签的文本,但是只有空单元格显示,没有内容 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIde
- (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;
}
我的代码有什么问题/还有其他解决方案吗
感谢您的时间和帮助。故事板中的单元标识符必须与单元标识符匹配
尝试在情节提要的UITableViewCell中添加标签,并为其添加自定义文件。这是更好的方法。对!我没有在情节提要中设置单元标识符。非常感谢。