Open mlykke opened 12 years ago
Thanks for noticing this bug... We definitely need to fix this so that the cell exhibits the expected behavior. However, it's not exactly the highest priority at the moment, as there are more pressing issues to deal with presently.
In the meanwhile, I'd recommend against embedding buttons in cells from a pure UX standpoint. Typically in iOS interfaces, we want the entire cell itself to perform the action. If your cell requires multiple actions (which is the only use-case I can think of for embedding a button), then you should do this with modes rather than with multiple inputs. For instance, you might have a multiselection mode, a deletion mode, or whatever sort of mode you want, which will determine the action that tapping on the entire cell performs. That's just my two cents.
So, it's a totally legitimate issue, but for now, I'd suggest that you just go with a different design if at all possible. I'm going to leave the issue open, since we do need to fix this at some point.
Thanks so much! Jon
This is a bit old, but in order to fix this issue, in the GMGridView.m, add the UIGestureDetectorDelegate method '(BOOL)gestureRecognizer:shouldReceiveTouch:'
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
if([touch.view isKindOfClass:[UIControl class]])
{
return NO;
}
return YES;
}
This method will work for, not only buttons, but sliders and toggle switches as well, without triggering the gesture detector.
thanks dridner, that solves the problem.
In each cell in my grid I have added a
UIButton
but when the button is pressed then both the button action is called as well as the-gridView:didSelectItemAtIndexPath:
. In a regularUITableView
the actual cell get activated if the press happens on a button.Also, the button is only called the first time it's pressed: since the cell is also selected and active any of the following presses doesn't get filtered to the
UIButton
.