Commit 50f3e701 authored by Zhen Tan's avatar Zhen Tan Committed by GitHub

Merge pull request #112 from Arthurli/fix-index-crash

修复 index 越界引起的崩溃
parents 26a4a47c f1e5c152
......@@ -196,6 +196,7 @@
[_tzImagePickerVc.selectedAssets removeObject:_assetsTemp[_currentIndex]];
[self.photos removeObject:_photosTemp[_currentIndex]];
}
break;
}
}
}
......@@ -246,8 +247,17 @@
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
CGPoint offSet = scrollView.contentOffset;
_currentIndex = (offSet.x + (self.view.tz_width * 0.5)) / self.view.tz_width;
[self refreshNaviBarAndBottomBarState];
CGFloat offSetWidth = offSet.x;
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
......
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