- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *identifier = [NSString stringWithFormat:@"MessageCell-%d",indexPath.row];
TKIMBaseCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
if (!cell) {
TKIMMsgType type = [_msgTypeArray[indexPath.row] integerValue];
switch (type) {
case TKIMKnowledgeMsg:
cell = [[TKIMKnowledgeCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
break;
case TKIMChooseMsg:
cell = [[TKIMChooseMsgCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
break;
default:
cell = [[TKIMChatViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
break;
}
cell.backgroundColor = [UIColor clearColor];
}
[cell setMessage:_dataSource[indexPath.row]];
return cell;
}
UITableView绑定不同的cell 的 ID 写法
最新推荐文章于 2020-11-02 20:25:36 发布