Thanks
Thanks

Reputation: 40369

How can I set the scrolling position of an UIScrollView?

I've seen the setContentOffset:animated: method. Is that going to scroll to a specific position, or what does that "offset" mean?

Upvotes: 24

Views: 32445

Answers (2)

Vincent Larroque
Vincent Larroque

Reputation: 121

You can control the animation using

[UIView animateWithDuration:1.2 animations:^{_scrollView.contentOffset = CGPointMake(X, Y);}];

Upvotes: 4

Rog
Rog

Reputation: 17170

Yes. From the Apple documentation:

setContentOffset:animated: Sets the offset from the content view’s origin that corresponds to the receiver’s origin.

Upvotes: 41

Related Questions