//Compute height for label based on text
CGSize labelStringSize = [self labelStringSize:lblInput.text];
cell.lblInput.frame = CGRectMake(x, y, 160,labelStringSize.height);
-(CGSize)labelStringSize : (NSString *) strInput { // Detemine height based on text
UILabel *tempLabel = [[UILabel alloc] init];
tempLabel.lineBreakMode = UILineBreakModeWordWrap;
tempLabel.text = [NSString stringWithFormat:@"%@",strInput];
CGSize labelStringSize = [tempLabel.text sizeWithFont:tempLabel.font constrainedToSize:CGSizeMake(143, 9999) lineBreakMode:tempLabel.lineBreakMode];
return labelStringSize;
}
No comments:
Post a Comment