I have a scroll that scrolls horizontally. I just added images, placemarks and web browsing to it, and it has a lot of objects. I want to directly scroll to the first object in the scroll. How to do it?
Use the following code:
scrollView.contentOffset = CGPointMake(0,0);
To animate your scrolling, follow these steps:
CGRect frame = CGRectMake(0, 768, 1024, 748); //wherever you want to scroll [self.scrollView scrollRectToVisible:frame animated:YES];
The easiest way with animation â
[scrollView setContentOffset:CGPointMake(0, 0) animated:YES]
Quick version 3 of the answer:
scrollView.contentOffset = CGPoint(x: 0.0, y: 0.0)