Hey,
I'm trying to calculate the height of the text constrained by a UITextView but it doesn't seem to return correct results.
Here is my code :
- (void)textViewDidChange:(UITextView *)aTextView {
CGSize textSize = [aTextView.text sizeWithFont:aTextView.font constrainedToSize:aTextView.frame.size lineBreakMode:UILineBreakModeWordWrap];
counter.text = [NSString stringWithFormat:@"%f", textSize.height];
}
You can download the sample project and a short screencast that illustrates the problem (418 KB).
In summary, the problem is that when I type a long word at the end of a line, the word is moved to the next line, but the height of the string isn't correctly adjusted when it happens.
Any help appreciated.
Best,
Thomas.
P.S. : It happens with the iPhone SDK 3.1.3