例外一个模版cell:(压缩包中 3.jpg)
4、实现如下代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section == 0) {
MessageSection0TableViewCell *cell = (MessageSection0TableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"message_section0"]; //直接通过标饰获取cell
cell.NotifiLb.text = notifArr[indexPath.row];
return cell;
}
if (indexPath.section == 1) {
MessageSection1TableViewCell *cell = (MessageSection1TableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"message_section1"];
FriendObj *obj = friendsArr[indexPath.row];
cell.NameLb.text = obj.f_name;
cell.introLb.text = obj.f_intro;
cell.HeaderIView.image = [UIImage imageNamed:@"icon_100"];
return cell;
}
return nil;
}