给UITextView
设置文字的时候,文字很长的话,默认是显示第一行。如果需要显示最后一行,需要手动设置textView
滚动到最后。
首先设置textView的属性
self.textView.layoutManager.allowsNonContiguousLayout = NO;
赋值文字后执行
[self.textView scrollRangeToVisible:NSMakeRange(self.textView.text.length, 1)];
一定要设置textView的layoutManager的allowsNonContiguousLayout,否则自动到底部的时候可能会闪一下。
网友评论