4-cell 注册机制

一. 纯代码创建Cell 注册

[_tableViewregisterClass:[weiboCell class] forCellReuseIdentifier:identifier];

二. 使用nib文件加载的Cell 注册

// 获取UINib对象
UINib* nib = [UINib nibWithNibName:@"AppCell" bundle:nil];

// 取出cell对象Owner 多视图控制器使用
AppCell *cell = [nib instantiateWithOwner:nil options:nil].lastObject;

// 使用nib对象注册
[collectionView registerNib:nib forCellWithReuseIdentifier:identifier];

三、prototype cell注册

1、Storyboard 中的UITableViewController必须关联一个自定义UITableView

在自定义UITableView.m文件中实现数据源方法等。

2、UITableViewCell 必须关联一个自定义UITableVieCell

在自定义UITableVieCell.m文件中,给子控件加载数据

3、设置cell标签

你可能感兴趣的:(4-cell 注册机制)