I am developing an application where i need to charge the user based on the number of pages. Can anyone tell me how can i derive number of pages if the data is entered as multiline in textView. Thanx in advance
+3
A:
You can use NSString's -sizeWithFont:constrainedToSize:lineBreakMode:
method to calculate the space a given amount of text would occupy.
Ole Begemann
2010-02-16 12:09:16
A:
thanks for the answer. This is what i have used and it worked....
-(float)getHeightByWidth:(NSString*)myString:(UIFont*)mySize:(int)myWidth
{
CGSize boundingSize = CGSizeMake(myWidth, CGFLOAT_MAX);
CGSize requiredSize = [myString sizeWithFont:mySize constrainedToSize:boundingSize lineBreakMode:UILineBreakModeWordWrap];
return requiredSize.height;
}
Suriya
2010-04-15 11:09:46
You don't accept your own answer in this case, you accept the one that helped you find a solution! You need to read Stack Overflow's FAQ. http://stackoverflow.com/faq
Emil
2010-06-13 10:20:43
i have removed my answer as cjecked bt whats in case you have found the answer yourself??
Suriya
2010-06-14 07:24:39