Monday, 30 September 2013

Weird contentSize.height after change UITextView's height in iOS7

Weird contentSize.height after change UITextView's height in iOS7

For setting variable height UITextView inside Storyboard with AutoLayout I
use this method:
CGSize size = [self.textView
sizeThatFits:CGSizeMake(self.textView.frame.size.width, FLT_MAX)];
self.textViewHeight.constant = size.height;
Where textView is UITextView object, and textViewHeight is a AutoLayout's
height constraint for textView. In iOS <7 that method works fine, but in
iOS 7 after that manipulation i have textView.contentSize.height value
exactly 2 times less than textView.frame.size.height. As a result,
UITextView in viewport presented in full size, but only the upper half of
its content is drawn.
Manually setting textView.contentSize does nothing, because layout process
automatically change this value to "half-height" again...

No comments:

Post a Comment