ios - UITextView always scrolls from the beginning when using scrollRangeToVisible() -
i'm debugging uitextview logs operation.
e.g. if press special button on screen, uitextview show button pressed. log more pressed more buttons, can scroll uitextview see past operation.
because uitextview doesn't scroll increasing text, try make scroll last line when logged it. try use scrollrangetovisible() method below
history.scrollrangetovisible(nsmakerange(count(history.text!) - 1, 1)) here history uitextview outlet.
the problem is, method makes uitextview scroll beginning designated nsrange. more specifically, reset view beginning of text , scroll down wherever nsrange is. want scroll directly down,
can solve problem? lot.
this link (what use instead of scrollrangetovisible in ios7 or textkit) suggests turning scrolling off, change switch on.
history.scrollenabled = no; [history scrollrangetovisible:nsmakerange(history.text.length - 1,0)]; history.scrollenabled = yes; edit
solved after discussion using:
history.layoutmanager.allowsnoncontiguouslayout = no;
Comments
Post a Comment