我知道这个问题之前发布过,我根据他们的更正修复了我的代码,但仍然没有得到单元格工作的细节,只有正文。下面是我的代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell==nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];//It's well initialized
}
cell.textLabel.text=[myArray objectAtIndex:indexPath.row];
cell.detailTextLabel.text=@"All the stores";
return cell;
}我假设看到的是一个文本和一个细节文本。然而,我只看到了正文。提前谢谢。
发布于 2012-06-17 14:22:51
故事板可能包含具有相同重用标识符的原型单元,并且它被配置为不同的样式(即没有副标题)。为了进行有效的调试,您可以删除对tableview的调用,使您获得一个出列的单元,并在每次新实例化一个单元时查看您的新单元是否正在工作。然而,我建议走另一条路,在故事板中配置一个原型单元,并使用它的配置(如果它不存在,甚至可能引发一个异常)。
https://stackoverflow.com/questions/11069326
复制相似问题