In Your case,[myscroll scrollRectToVisible:myview.frame animated:YES];
will not work because of myview is a sub-view of myscroll. myview.frame
will return the CGRect which is only related to the myscroll.
My suggestion is , you can acheive the functionality through UIpageControl + UIScrollView . You can set UIPageControl as Hidden.
SampleCode
int page = sidePager.currentPage + 1;
CGRect frame = scroller.frame;
frame.origin.x = frame.size.width * page;
if (0 != UpAndDownPager.currentPage) {
frame.origin.y = frame.size.height * (UpAndDownPager.currentPage + 1 );
}
scroller scrollRectToVisible:frame animated:YES];
sidePager.currentPage = sidePager.currentPage + 1;
Note:
sidePager: UIPageControl For Right-Left position
UpAndDownPager: UIPageControl For Top-Bottom position