How to get scrolled position in textview? (Swift)

3518 views ios

At the moment my app uses a scrollable text view to show text files- it's pretty simple, but what I'd like to do is have the app remember how far the view had been scrolled through for when it's reopened.

I know how to save the info, but I don't know how to find it in the first place- is there a way to get the position or coordinates of the current scrolling position?

answered question

1 Answer


UITextView extends UIScrollView which has contentOffset. That's a CGPoint. The y property is how far down the user has scrolled.

posted this

Have an answer?


Please login first before posting an answer.