根据内
2016-03-22 本文已影响101人
傲骨天成科技
// 根据内容自适应单元格的高度
//先得到内容
NSDictionary *dic=self.allDataArray[indexPath.row];
NSString *contentStr=[dic objectForKey:@"content"];
CGRect rect=[contentStr boundingRectWithSize:CGSizeMake(self.view.frame.size.width-40, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:17]} context:nil];
//当内容自适应时需要将行数设置为0
_contentLable.numberOfLines=0;