##NSTextView Auto-Scrolled to Bottom

NSTextView Auto-Scrolled to Bottom

当文字输入多时,光标自动滚动到输入到底部

1.

直接使用[textView scrollRangeToVisible: NSMakeRange ([[textView string] length], 0)];是不行的,必须把这个NSTextView放到NSScrollView中这个方法才可以使用

参考:

  1. https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/TextUILayer/Tasks/TextInScrollView.html#//apple_ref/doc/uid/20000938-CJBBIAAF
  2. https://forums.macrumors.com/threads/scrolling-an-nstextview.512398/

posted on 2017-02-21 15:23  ZhYQ_note  阅读(466)  评论(0)    收藏  举报

导航