Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

DennisBlah

macrumors 6502
Original poster
Dec 5, 2013
485
2
The Netherlands
Hi all,

I'm facing an issue when I'm adding text to an UITextView programaticly.

I want the textview always to be in the bottom.
So when I receive new text I send:
[myTextView scrollRangeToVisible:NSMakeRange([myTextView.text length], 0)];

But when I'm receiving multiple lines etc, it keeps jumping up and down, until I'm not receiving anymore and its down.

How can I keep the textView always at the end ?
P.s. it must be able to be turned off when I'm scrolling into it.

I have an timer that checks the last line, and if its changing, it must be at the bottom. If not I must be able to scroll.

It is working, but its not so fancy to have a jumping scrollview.

Please advice, anyone ??

-----

Sorry for this thread. I been busy for it for 2 days now. Suddenly I found some answer which actually works.

Taking out all scrollEnabled and programaticly scrolling.

And added this when I'm sending text to the scrollview:
Code:
[myTextView setText: [myTextView.text stringByAppendingString: appendingStrings]];
    [myTextView scrollRangeToVisible: myTextViewselectedRange];

And in my viewdidload
Code:
 myTextView.layoutManager.allowsNonContiguousLayout = NO;

Hopefully it will be off any use for anyone else with the same issue
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.