Quote:
Originally Posted by bladeolson
I have a scrollview that contains 15 separate views. I can page by swiping left or right. Works great.
I want to add a LEFT and RIGHT button instead of swiping. Any ideas how I might do this?
blade
|
I believe the property you are looking for is contentOffset. That determines where in the ScrollView is currently displayed. So on a paging thing the code would look like this.
Code:
-(IBAction)goRight:(id)sender {
CGPoint curr = [scrollView contentOffset];
/* Page size would normally be 320 or something similar, we want one full page */
curr.x += pageSize;
[scrollView setContentOffset:curr];
}
It would be the same thing for goLeft, just -= instead of +=