Commit f1e5c152 authored by Arthur.li's avatar Arthur.li

修复 index 越界引起的崩溃

parent 739cd943
...@@ -196,6 +196,7 @@ ...@@ -196,6 +196,7 @@
[_tzImagePickerVc.selectedAssets removeObject:_assetsTemp[_currentIndex]]; [_tzImagePickerVc.selectedAssets removeObject:_assetsTemp[_currentIndex]];
[self.photos removeObject:_photosTemp[_currentIndex]]; [self.photos removeObject:_photosTemp[_currentIndex]];
} }
break;
} }
} }
} }
...@@ -246,8 +247,17 @@ ...@@ -246,8 +247,17 @@
- (void)scrollViewDidScroll:(UIScrollView *)scrollView { - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
CGPoint offSet = scrollView.contentOffset; CGPoint offSet = scrollView.contentOffset;
_currentIndex = (offSet.x + (self.view.tz_width * 0.5)) / self.view.tz_width; CGFloat offSetWidth = offSet.x;
[self refreshNaviBarAndBottomBarState]; if ((offSetWidth + (self.view.tz_width * 0.5)) < scrollView.contentSize.width) {
offSetWidth = offSetWidth + (self.view.tz_width * 0.5);
}
NSInteger currentIndex = offSetWidth / self.view.tz_width;
if (_currentIndex != currentIndex) {
_currentIndex = currentIndex;
[self refreshNaviBarAndBottomBarState];
}
} }
#pragma mark - UICollectionViewDataSource && Delegate #pragma mark - UICollectionViewDataSource && Delegate
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment