How can i scroll the scrollview when click on button above scrollview in ios 7 xcode?
ios, iphone, objective-c, uiview
Solution
[self.scrollView setContentOffset:CGPointZero animated:YES];
or if you want to preserve the horizontal scroll position and just reset the vertical position:
[self.scrollView setContentOffset:CGPointMake(self.scrollView.contentOffset.x, 0)
animated:YES];
Problem
I have two buttons. I also have two screens in scrollview that is one is `UIView` in green color and other is `UIImage` Apple logo. Both display properly but I just take the screen shot like that. When I click on registration button then in scrollview display the `UIView` that is the green view! And when I click on image button it show the `UIImageView` that is Apple logo . i take the screen shot like that the scrollview scroll and the green view is uiview and second behind it is image view that contain the image ``` //help me -(IBAction)registrationClick:(id)sender { NSLog(@"mayank"); CGRect frame; frame.origin.x = self.scrollView.frame.size.width * self.pageControl.currentPage; frame.origin.y = 0; frame.size = self.scrollView.frame.size; [self.scrollView scrollRectToVisible:frame animated:YES]; pageControlBeingUsed = YES; } ```