I am getting JSON response from server and set that contents to UILabel
and sometimes the text will be one line and sometimes the text will be 10 lines.So i display this UILabel
inside the UIScrollView
. But i got the empty space in UILabel
This is my screenshots..
Currently i am using storyboard and auto layout
So i want to avoid these empty space in UILabel
. Please give me suggestions for this alignment issues.??
Code for changing UILabel
height but this is not working for me
CGRect textRect = [strDetailsFinal boundingRectWithSize:CGSizeMake(296, FLT_MAX)
options:NSStringDrawingUsesLineFragmentOrigin
attributes:@{NSFontAttributeName: labDetails.font}
context:nil];
CGSize size = textRect.size;
CGRect newFrame = labDetails.frame;
newFrame.size.height = size.height;
labDetails.frame = CGRectMake(160, 200, 300, newFrame.size.height);