DecembeGrirl / YSHYImageView

图片显示器
6 stars 2 forks source link

数组越界 #1

Open qqq5201260 opened 8 years ago

qqq5201260 commented 8 years ago

-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { self.currentPoint = _scrollerview.contentOffset; NSInteger b = self.currentPoint.x/_scrollerview.frame.size.width + 1 ; // 添加越界处理 if (b<1) { b=1; }else if (b>_bigImageArray.count){ b=_bigImageArray.count; } self.lastZoomScrollView = self.currentZoomScrollView; self.currentZoomScrollView = scrollView.subviews[b-1]; if(![self.lastZoomScrollView isEqual:self.currentZoomScrollView]) { //让滑过去的image恢复默认大小 float newScale = self.lastZoomScrollView.minimumZoomScale; [self.lastZoomScrollView scrollViewDidEndZooming:self.lastZoomScrollView withView:self.lastZoomScrollView.imageView atScale:newScale]; }

[UIView beginAnimations:nil context:nil];
[UIView animateWithDuration:0.2 animations:^{
    NSInteger index = scrollView.contentOffset.x / scrollView.frame.size.width;
    _pageControl.currentPage = index;
} completion:nil];
[UIView commitAnimations];

}

DecembeGrirl commented 7 years ago

谢谢 已更新