I have a UIScrollView with set of images with left and right button. I have implement the left button action for moving the image left side using this code
if ( scroll.contentOffset.x <= scroll.frame.size.width ) {
CGRect frame;
frame.origin.x = scroll.contentOffset.x + scroll.frame.size.width;
frame.origin.y = 0;
frame.size = scroll.frame.size;
//NSLog(@"%f %f %f", frame.origin.y ,scroll.frame.size.width, frame.origin.x);
[scroll scrollRectToVisible:frame animated:YES];
}
its working perfectly
same i implement the functionality for right button action not working properly what i am doing wrong the code is below
if ( scroll.frame.size.width <= scroll.contentOffset.x ) {
CGRect frame;
frame.origin.x = scroll.contentOffset.x - scroll.frame.size.width;
frame.origin.y = 0;
frame.size = scroll.frame.size;
[scroll scrollRectToVisible:frame animated:YES];
}