1.关于原生UITableViewCell的简单使用
NSString *CellIdentifier = [NSString stringWithFormat:@"tcell%ld", (long)[indexPath row]];//以indexPath来唯一确定cell
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
BaseLabel *lab_tc = [BaseLabel labelWithFrame:CGRectMake(20, 20, 75, 30) text:@"" textColor:[UIColor darkGrayColor] font:[UIFont systemFontOfSize:14] textAlignment:NSTextAlignmentLeft backgroundColor:[UIColor clearColor]];
[cell.contentView addSubview:lab_tc];
return cell;
2.自定义cell的使用
NSString *CellIdentifier = [NSString stringWithFormat:@"RZOrderInfoCarCell%ld", (long)[indexPath row]];
//以indexPath来唯一确定cell,在tableview中复用此cell时,不会造成数据紊乱
RZOrderInfoCarCell *cell = [tableView
dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell) {
cell = [[[NSBundle mainBundle]
loadNibNamed:@"RZOrderInfoCarCell"
owner:self options:nil]lastObject];
[cell setValue:CellIdentifier forKey:@"reuseIdentifier"];
}
return cell;