Problems with iOS 10.2 - infinity cycle
ed8009 opened this issue · 2 comments
I started on a real device, but the problem can be reproduced on the simulator (I tried with iphone 7 plus iOS 10.2). If you enter some text in the textView, then select the text and click "Select All". The application will be in an infinity cycle, called layoutSubviews.
I tried to fix the problem and added a custom class for the textView. I redefine the intrinsicContentSize, it works, but there are other difficulties. Tell me how to fix this problem. The test project was add into my repository:
https://github.com/ed8009/textView-With-JVFloatLabeledTextView
The problem occurs when scrollEnabled = NO
I do not quite understand this code, but if I remove it, everything works fine:
if (!self.scrollEnabled && !CGSizeEqualToSize(self.bounds.size, [self intrinsicContentSize])) {
[self invalidateIntrinsicContentSize];
}
Solution:
if (!self.scrollEnabled && !CGSizeEqualToSize(self.bounds.size, [self intrinsicContentSize])) { [self layoutIfNeeded]; }