Scroll to bottom of UITextView erratic in iOS 7

前端 未结 9 1667
无人及你
无人及你 2020-12-01 04:58

The following code will work fine in iOS < 7.0. In iOS 7 the scrolling will be choppy and erratic while the UITextView is updating. I\'m not sure if this is a bug in iO

9条回答
  •  情深已故
    2020-12-01 05:18

    That works for me. Reference: UITextView setText should not jump to top in ios8

    self.textView.layoutManager.allowsNonContiguousLayout = NO;
    self.textView.text = fileContent;
    if(fileContent.length > 1)
    {
        NSRange range = NSMakeRange(self.textView.text.length - 1, 1);
        [self.textView scrollRangeToVisible:range];
    }
    

提交回复
热议问题