- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
Message *msgObj = _items[(NSUInteger) indexPath.row];
NSString *msg = msgObj.content;
CGFloat maxWidth = CGRectGetWidth(tableView.bounds);
CGFloat msgCellWidth = maxWidth - MessageCellAvatarPadding * 2 - AVATAR_HEIGHT - MessageCellPadding-20;
CGFloat height = [MsgCell heightForMessage:msg constrainedToWidth:msgCellWidth];
return height+20;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
MsgCell *msgItemCell = [tableView dequeueReusableCellWithIdentifier:kMsgCellId forIndexPath:indexPath];
Message *msg = self.items[(NSUInteger) indexPath.row];
[msgItemCell setMessage:msg];
return msgItemCell;
}