0
- (CGFloat)를 tableView (jQuery과 *)를 tableView heightForRowAtIndexPath (NSIndexPath *) indexPath {의 tableview 셀 IOS에서 labet 텍스트와 셀 높이 확장
NSString * message =[[chatData objectAtIndex:indexPath.row]valueForKey:@"message"];
NSString * message_type = [[chatData objectAtIndex:indexPath.row]valueForKey:@"message_type"];
if([[[chatData objectAtIndex:indexPath.row]valueForKey:@"message_type"] isEqualToString:@"0"]){
CGSize sizeText = [self text:message sizeWithFont:[UIFont systemFontOfSize:16] constrainedToSize:CGSizeMake(CGRectGetWidth([UIScreen mainScreen].bounds) - 100, 9999) withLinebreakmode:NSLineBreakByWordWrapping];
CGFloat heightOfRow = sizeText.height + 2 * 7.5f;
return heightOfRow + 50;
}
else
return 225;//message_type 1 3 4
// return self.chatTable.rowHeight;
}
프라그 마크 - ChatLabel 폭 운반
- (CGSize) 텍스트 (는 NSString *) 텍스트 sizeWithFont (UIFont *) 폰트 constrainedToSize (CGSize) ConstSize withLinebreakmode (NSLineBreakMode) linebreakmode { CGSize의 retsize;
if ([text respondsToSelector:@selector(boundingRectWithSize:options:attributes:context:)])
{
NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.lineBreakMode = linebreakmode;
// paragraphStyle.alignment = NSTextAlignmentLeft;
NSDictionary * attributes = @{NSFontAttributeName : font,NSParagraphStyleAttributeName : paragraphStyle};
retsize = [text boundingRectWithSize:ConstSize options:NSStringDrawingUsesFontLeading
|NSStringDrawingUsesLineFragmentOrigin attributes:attributes context:nil].size;
retsize.height =ceilf(retsize.height);
retsize.width =ceilf(retsize.width);
NSLog(@"%f",retsize.width);
}else{
if ([text respondsToSelector:@selector(sizeWithFont:constrainedToSize:lineBreakMode:)]){
retsize = [text sizeWithFont:font
constrainedToSize:ConstSize
lineBreakMode:linebreakmode];
retsize = [text boundingRectWithSize:ConstSize options:NSStringDrawingUsesLineFragmentOrigin attributes:nil context:nil].size;
}
}
//[self viewWillAppear:YES];
return retsize;
}