UITableView 的一个常见错误'unable to dequeue a cell with identifier Cell - must register a nib or a class f
2014-08-07 17:37
369 查看
运行,出错了,关键性提示如下:
'unable to dequeue a cell with identifier Cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
看起来是单元格的ID有问题。
因为我们这里用的是动态单元格了,因此这个单元格必须有一个ID。这里,我设置该单元格的ID为
Cell。
然后,编辑以下函数的代码:
'unable to dequeue a cell with identifier Cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
看起来是单元格的ID有问题。
因为我们这里用的是动态单元格了,因此这个单元格必须有一个ID。这里,我设置该单元格的ID为
Cell。
然后,编辑以下函数的代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier ]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } switch (indexPath.row) { case 0: cell.textLabel.text=@"渝开发 000514"; break; case 1: cell.textLabel.text=@"我的第一桶金"; break; default: break; } // Configure the cell... return cell; }
相关文章推荐
- TableView unable to dequeue a cell with identifier Cell - must register a class or Nib
- UITableViewCell unable to dequeue a cell with identifier Cell - must register a nib or a class for t
- unable to dequeue a cell with identifier xxx - must register a nib or a class fo
- unable to dequeue a cell with identifier - must register a nib or a class for the identifier...问题
- unable to dequeue a cell with identifier cell - must register a nib or a class for the identifier or
- unable to dequeue a cell with identifier xxx - must register a nib or a class for the identifier
- swift写一个简单的列表unable to dequeue a cell with identifier reuseIdentifier - must register a nib or a cla
- UITableViewCell unable to dequeue a cell with identifier Cell - must register a nib or a class for the identifier or connect a prototype cell
- unable to dequeue a cell with identifier Identify - must register a nib or a class for the identifie
- UITableView使用注意事项(unable to dequeue a cell with identifier)
- must register a nib or a class for the identifier or connect a prototype cell in a storyboard'的解决办法
- unable to dequeue a cell with identifier shopCell
- UITableView 重用cell方法edequeueReusableCellWithIdentifier,出现错误
- Xcode error: unable to dequeue a cell with identifier cell
- 哈02—kill error_______unable to dequeue a cell with identifier Cell
- unable to dequeue a cell with identifier Cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
- Xcode unable to dequeue a cell with identifier
- Q6:关于xcode TableView使用Nib文件出现Assertion failure in dequeueReusableCellWithIdentifier:forIndexPath:错误
- UITableView学习之辨析两个方法:⓵dequeueReusableCellWithIdentifier与⓶dequeueReusableCellWithIdentifier:forIndexPath:
- UITableView dequeueReusableCellWithIdentifier