IOS:UITextView
lastmod 2014-02-10created 2014-02-103 edits
Troubleshooting
A summary of solutions to UITextView-related problems.
iOS7 UITextView contentsize.height alternative
- iOS7 UITextView contentsize.height alternative
- IOS7 get UITextView contentSize before viewDidAppear method is called?
On iOS7 there is a bug where the UITextView.contentsize.height property is not calculated correctly. The function below can be used instead to calculate the on-screen size of the String directly.
-(CGSize)sizeOfText:(NSString *)textToMesure widthOfTextView:(CGFloat)width withFont:(UIFont*)font
{
CGSize size = [textToMesure sizeWithFont:font constrainedToSize:CGSizeMake(width, FLT_MAX) lineBreakMode:NSLineBreakByWordWrapping];
return size;
}
Pages that link here