美文网首页
更新UITextView后,自动显示到最下面内容

更新UITextView后,自动显示到最下面内容

作者: 巴赫海兹 | 来源:发表于2018-07-23 14:32 被阅读16次

     1.设置了 UITextView 中的 layoutManager(NSLayoutManager) 的是否非连续布局属性,默认是 YES,设置为 NO 后 UITextView 就不会再自己重置滑动了。

    _logView.layoutManager.allowsNonContiguousLayout =NO;

     2.每次添加内容后,将视图滚动到最后

    [_logTextView scrollRangeToVisible:NSMakeRange(_logTextView.text.length,1)];

    相关文章

      网友评论

          本文标题:更新UITextView后,自动显示到最下面内容

          本文链接:https://www.haomeiwen.com/subject/ekcjmftx.html