How do I scroll to a position programmatically in UIScrollView

user1072740 picture user1072740 · Dec 27, 2011 · Viewed 60.7k times · Source

I have a scroll view which scrolls horizontally. I just added images, labels and a webview in it and there are many objects in it. I want to directly scroll to the first object in the scroll view. How do I do this?

Answer

Saurabh Passolia picture Saurabh Passolia · Dec 27, 2011

Use the following code:

scrollView.contentOffset = CGPointMake(0,0);