Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

crashed in UIGestureRecognizerStateBegan #64

Open
zerochocobo opened this Issue Mar 30, 2012 · 2 comments

Comments

Projects
None yet
2 participants

sometimes,it may be crash....

GMGridView.m,line 1071.

    case UIGestureRecognizerStateBegan:
    {
        CGPoint locationTouch = [_tapGesture locationInView:_scrollView];
        NSInteger position = [self.layoutStrategy itemPositionFromLocation:locationTouch];

        if (position != GMGV_INVALID_POSITION) 
        {
            [(GMGridViewCell*)[self.itemSubviews objectAtIndex:position] setSelected:YES];
        }
        break;
    }

should change to:

    case UIGestureRecognizerStateBegan:
    {
        CGPoint locationTouch = [_tapGesture locationInView:_scrollView];
        NSInteger position = [self.layoutStrategy itemPositionFromLocation:locationTouch];

        if (position != GMGV_INVALID_POSITION && [self.itemSubviews count]>position) 
        {
            [(GMGridViewCell*)[self.itemSubviews objectAtIndex:position] setSelected:YES];
        }
        break;
    }

then fix it.

Contributor

steipete commented Mar 30, 2012

Isn't that symtom fixing? Why is layoutStrategy returning an invalid position in the first place? What layout are you using?

I used default layout. I don't know why the position is larger than [self.itemSubviews count]. When I scroll screen from up to down,then the program is crash...... I added SIGART break and found this position.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment