In Xcode, I created a UILabel which will autoresize depending on how many lines of text I put on it. But I don\'t want the UILabel\'s height to exceed a certain limit (240 i
You can add your UILabel on a UIScrollView Like this and can also do like this---
scrollView.backgroundColor = [UIColor clearColor];
UILabel * label = [[UILabel alloc] init];
[label setNumberOfLines:0];
label.text=[detailDict valueForKey:@"ABC"];
[label setFont:[UIFont fontWithName:@"Georgia" size:16.0]];
CGSize labelsize=[label.text sizeWithFont:label.font constrainedToSize:CGSizeMake(250, 1000.0) lineBreakMode:UILineBreakModeWordWrap];
int y=0;
label.frame=CGRectMake(38, y, 245, labelsize.height);
[label setBackgroundColor:[UIColor clearColor]];
[label setTextColor:[UIColor whiteColor]];
scrollView.showsVerticalScrollIndicator = NO;
y+=labelsize.height;
[scrollView setContentSize:CGSizeMake(200,y+50)];
[scrollView addSubview:label];
[label release];
Here Y is used to increase or decrease the label size as the text.