Reputation: 503
I have 6 buttons on a scroll view and when the user presses on of the buttons all of the buttons change title like a menu. However I would like the ScrollView to reset it self to the top, so the first few buttons are visible and the user is able to scroll down once again.
Upvotes: 3
Views: 14262
Reputation: 73
Swift 4
self.scrollView.contentOffset = CGPoint(x:250, y:100)
x and y are the respective width and height from the top left corner of your scrollview. Apple documentation on contentOffset
Upvotes: 1
Reputation: 9754
If you are using a scrollView, simply change scrollView.contentOffset
to move your scroll view's visible window. Like x:0, y:0
to the top.
You should read some documents to understand contentOffset
, contentSize
and so on.
Upvotes: 5