objective c - Smooth UITextView auto scroll to bottom of frame -
im using xcode 5.1.1 developing ios7. there new text entering uitextview, if text went up, leaving room user see new text. have works animation shows new text awkward. if goes top of text , goes bottom every time called.
cgpoint p = [textview contentoffset]; [textview setcontentoffset:p animated:no]; [textview scrollrangetovisible:nsmakerange([textview.text length] - 1,0)];
this code getting called every time new text entered. smooth default iphone messenger slides casually.
the right answer set:
_consoleview.layoutmanager.allowsnoncontiguouslayout = no;
in viewdidload
then:
_consoleview.text = text; [_consoleview scrollrangetovisible:nsmakerange(_consoleview.text.length - 1, 1)];
Comments
Post a Comment