Skip to content

Issue while scrolling below 0 offset of scroll view #53

@kanwarpal

Description

@kanwarpal

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions