Josh
Josh

Reputation: 25

How to get scrolled position in textview? (Swift)

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?

Upvotes: 1

Views: 902

Answers (1)

rmaddy
rmaddy

Reputation: 318784

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

Upvotes: 1

Related Questions