- (void)viewDidLoad {
[superviewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
// 自定根据布局计算cell的行高
self.tableView.rowHeight =UITableViewAutomaticDimension;
self.tableView.estimatedRowHeight=44.0f;
// storyboard其实内部就会帮你注册一个cell
//[self.tableView registerClass:[StatusCell class] forCellReuseIdentifier:ID];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.statuses.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
// forIndexPath不能使用自己创建的cell
StatusCell *cell = [tableViewdequeueReusableCellWithIdentifier:IDforIndexPath:indexPath];
/*
dequeueReusableCellWithIdentifier:
// 从缓存池里面去取
// 判断下tableView有没有注册cell,如果有,就直接创建cell
// 返回nil
*/
cell.status =self.statuses[indexPath.row];
return cell;
}
@end