Open kanwarpal opened 10 years ago
Hi,
I have faced an issue in scrolling images when we scroll very fast and scroll view offset becomes -ve, i that case app will crash
Can you please check the code?
I have fixed that in below method by adding
if(_scroller.contentOffset.x < 0) return;
(void)scrollingHasEnded {
_isScrolling = NO; if(_scroller.contentOffset.x < 0) return; NSUInteger newIndex = floor( _scroller.contentOffset.x / _scroller.frame.size.width );
// don't proceed if the user has been scrolling, but didn't really go anywhere. if( newIndex == _currentIndex ) return;
// clear previous [self unloadFullsizeImageWithIndex:_currentIndex];
_currentIndex = newIndex; [self updateCaption]; [self updateTitle]; [self updateButtons]; [self loadFullsizeImageWithIndex:_currentIndex]; [self preloadThumbnailImages]; }
If its fine then please update the code so that in future if anyone use this then should not face this issue.
Thanks
Hi,
I have faced an issue in scrolling images when we scroll very fast and scroll view offset becomes -ve, i that case app will crash
Can you please check the code?
I have fixed that in below method by adding
if(_scroller.contentOffset.x < 0) return;
(void)scrollingHasEnded {
_isScrolling = NO; if(_scroller.contentOffset.x < 0) return; NSUInteger newIndex = floor( _scroller.contentOffset.x / _scroller.frame.size.width );
// don't proceed if the user has been scrolling, but didn't really go anywhere. if( newIndex == _currentIndex ) return;
// clear previous [self unloadFullsizeImageWithIndex:_currentIndex];
_currentIndex = newIndex; [self updateCaption]; [self updateTitle]; [self updateButtons]; [self loadFullsizeImageWithIndex:_currentIndex]; [self preloadThumbnailImages]; }
If its fine then please update the code so that in future if anyone use this then should not face this issue.
Thanks