用storyboard可以很方便的实现static cell,只需要在inspector中选择static cell即可,但是在代码中如何实现呢? 可以使用下面的代码来实现:
NSString *cellIdentifier = [NSString stringWithFormat:@"%li", indexPath.row];
MeasureTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
cell = [[MeasureTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
网友评论