This question already has an answer here:
I am using the below code to calculate the height of a label from string length. Im using xcode 5.0 and it works fine in iOS 6 simulator but it's not working well in iOS 7.
NSString* str = [[array objectAtIndex:i]valueForKey:@"comment"];
CGSize size = [className sizeWithFont:[UIFont systemFontOfSize:15]
constrainedToSize:CGSizeMake(300, MAXFLOAT) lineBreakMode:UILineBreakModeWordWrap];
Height_1 = size.height;
If there is any solution for iOS 7 then please help. Thanks in Advance
Try using this
Use Below Code to get the height of the Label
is deprecated. Use
instead
Well here is a solution I use for calculating the height for iOS 6 and iOS 7, and I have passed few arguments to make it reusable.
Hope this helps and yes any suggestions are appreciated. Happy Coding :)
For iOS 7 and above use below method.