I have used
CGSize textSize = [text sizeWithFont:cellFont constrainedToSize:constraintSize lineBreakMode:NSLineBreakByWordWrapping];
and return newHeight
;
to compute dynamic height of table cell. But in iOS 7 this is no more. So does iOS 7 has similar like this to compute dynamic height of cell or pickerview row height.
Updated Code:
NSString *text =str.text ;
CGSize constraintSize = CGSizeMake(320.0f, 40.0f); // Make changes in width as per your label requirement.
CGRect textRect = [text boundingRectWithSize:constraintSize
options:NSStringDrawingUsesLineFragmentOrigin
attributes:@{NSFontAttributeName:[UIFont fontWithName:@"Avenir" size:17]}
context:nil];
CGSize size = textRect.size;
NSLog(@"textSize :: %f",size.height);
return size.height;
I want to set font size of text i am setting for picker view in following method.
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
NSString *title;
title=@"The Grand Bhagvati S G Highway";
return title;
}