Unfortunately, using NSString -stringWithFont: forWidth: lineBreakMode: does not work - which wrapper mode you choose, the text wraps around a width that is less than the current width, and the height becomes 0 on any overflow lines. To get the real number, set the line to a frame that is higher than the one you need, then you will get a height that is greater than your actual height.
Pay attention to my fiction in this (subtracting 15 from the width). This may be due to my views (I have one in the other), so you may not need it.
- (BOOL)textView:(UITextView *)aTextView shouldChangeTextInRange:(NSRange)aRange replacementText:(NSString*)aText { NSString* newText = [aTextView.text stringByReplacingCharactersInRange:aRange withString:aText];
Jane Sales Apr 08 '09 at 6:10 2009-04-08 06:10
source share