File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -706,8 +706,9 @@ - (CGSize)measureSize:(CGFloat)maxWidth {
706706 container.size = CGSizeMake (maxWidth, CGFLOAT_MAX );
707707 [layoutManager ensureLayoutForTextContainer: container];
708708 CGRect usedRect = [layoutManager usedRectForTextContainer: container];
709- textView.contentSize = CGSizeMake (maxWidth, ceil (usedRect.size .height ));
710- return CGSizeMake (maxWidth, ceil (usedRect.size .height ));
709+ CGSize contentSize = CGSizeMake (maxWidth, ceil (usedRect.size .height ));
710+ textView.contentSize = contentSize;
711+ return contentSize;
711712}
712713
713714// make sure the newest state is kept in _state property
@@ -1364,8 +1365,10 @@ - (void)anyTextMayHaveBeenModified {
13641365
13651366- (void )didMoveToWindow {
13661367 [super didMoveToWindow ];
1367- // used to run all lifecycle callbacks
1368- [self layoutIfNeeded ];
1368+ if (self.window != nil ) {
1369+ // used to run all lifecycle callbacks
1370+ [self anyTextMayHaveBeenModified ];
1371+ }
13691372}
13701373
13711374// MARK: - UITextView delegate methods
You can’t perform that action at this time.
0 commit comments