Smooth UITextView auto scroll to bottom of frame

前端 未结 2 1583
梦毁少年i
梦毁少年i 2021-01-18 23:38

Im using Xcode 5.1.1 developing for ios7. As there is new text entering the UITextView, I would like it if the text went up, leaving room for the user to see the new text. I

2条回答
  •  我在风中等你
    2021-01-19 00:32

    The RIGHT answer is to set:

    _consoleView.layoutManager.allowsNonContiguousLayout = NO;
    

    In ViewDidLoad

    Then:

    _consoleView.text = text;
    [_consoleView scrollRangeToVisible:NSMakeRange(_consoleView.text.length - 1, 1)];
    

提交回复
热议问题