如何在 iOS 中单击下一步按钮后水平滚动图像

How to Image scroll in Horizontally after click on next button in iOS

在我的应用程序中,我想创建一个图片库。所以我使用了REPagedScrollView。我可以在滚动时滚动图像。但是当我点击下一个和上一个按钮时,我无法更改图像。那么如何实现这个功能呢? 滚动后多个图像变化,它的工作完美。 单击下一步按钮后,我尝试使用以下代码更改图像。

- (void)viewDidLoad
{
    [super viewDidLoad];

    scrollView = [[REPagedScrollView alloc] initWithFrame:self.slider_view.bounds];
    scrollView.delegate=self;
}

- (void)scrollViewDidScroll:(UIScrollView *)scrollView1
{
    if(scrollView1.tag ==0){
        CGFloat pageWidth = scrollView1.frame.size.width;
        current_page = floor((scrollView1.contentOffset.x - pageWidth / 2.0) / pageWidth) + 1;
        self.index_lbl.text = [NSString stringWithFormat:@"%d of %lu",current_page+1,(unsigned long)[self.seletedfile count]];
    }
}
-(IBAction)nextBtn:(id)sender
{
}

在下一个按钮方法中只需执行:

[scrollView scrollToPageWithIndex:current_page + 1 animated:YES];