Created
April 13, 2014 09:35
-
-
Save YGeorge/10576558 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ChatMessage *message = [chatMessages objectAtIndex:indexPath.row]; | |
CGFloat topMargin = (indexPath.row == 0) ? 18 : 0; | |
CGRect stringRect = [message.text boundingRectWithSize:CGSizeMake(200, MAXFLOAT) | |
options:NSStringDrawingUsesLineFragmentOrigin | |
attributes:@{ NSFontAttributeName : [UIFont fontWithName:CHAT_CELL_FONT size:14] } | |
context:nil]; | |
CGSize stringSize = CGRectIntegral(stringRect).size; | |
CGFloat bottomMargin = [self isMessageHasTail:indexPath.row] ? 30 : 20; | |
return stringSize.height + bottomMargin + topMargin; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment