iOS--加载cell


12nd,Jan,2016


1. 默认加载cell



2.通过xib加载
使用xib文件加载cell,报错:

'NSInternalInconsistencyException', reason: 'unable to dequeue a cell with identifier RootCell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'

分析: 两种解决方式:
1) 自定义cell时,可重用队列 不要使用 [tableView dequeueReusableCellWithIdentifier: forIndexPath], 使用[tableView dequeueReusableCellWithIdentifier]。
2) 先注册nib ;
即 加载xib的cell方式:
  1) cell类型 UITableViewCell 与xib的cell 类型 两者均可。

2) 首先读取自定义cell的xib文件 ,然后在tableview中注册


13rd,Jan,2016

 继承UITableView, 则有/**  UITableViewCellRowAtIndexPath:**/方法,也是返回cell。

与cellForRowAtIndexPath不一样,有的时候没注意就将UITableViewCellRowAtIndexPath当做cellForRowAtIndexPath方法。其实该方法不是代理方法。


17th,Jan,2016
去掉tabeView的分割线
设置tableView的 separatorStyle属性为NO;











你可能感兴趣的:(iOS--加载cell)