【发布时间】:2015-02-26 19:18:29
【问题描述】:
我正在构建一个UITableView,其中包含一些单元格。但是,它一直在抛出unable to dequeue a cell with identifier cell。我正在使用下面的代码,它应该可以工作。我做错了什么?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
if (!cell)
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier: cellIdentifier];
cell.textLabel.text = [self.ninjas[indexPath.row] name];
NSString *imageUrl = [NSString stringWithFormat: @"%@", [self.ninjas[indexPath.row] thumbnail]];
[cell.imageView setImageWithURL:[NSURL URLWithString:imageUrl]
placeholderImage:[UIImage imageNamed:@"50-50.jpg"]];
return cell;
}
我没有为此应用使用情节提要。
【问题讨论】:
-
您是否将单元格标识符分配给情节提要中的单元格?
标签: ios uitableview