Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handling touchesBegan in UITableViewCell disables didSelectRowAtIndexPath

I'm implementing swipe gestures in my customtableviewcell control and so I hvae to implement touchesBegan event. I'm able to implement the swipes, but unfortunately, because the touchesBegan gets handled in the customcell, i'm not getting a didSelectRowAtIndexPath message on the tablecontroller. If the touchesBegan method is disabled, it works.

How should this be handled? I want the touch event to bubble up the responder chain after the touchesBegan is processed. How can I do this?

Thanks.

like image 994
Mugunth Avatar asked May 31 '09 14:05

Mugunth


1 Answers

I"m sure you can see that this is happening because you are overriding a method that was previously defined on a super class. and by doing so means that the events are not being called.

have you tried calling [super touchesBegan]? that way all upstream stuff is handled. and you can override the swipe gesture.

or another option is to call the delegate when the touch is detected in your own touches method.

something like (you will probably have implementations of the other touch events as well)

-(void) touchesBegan
{
 //logic to detect tap only.
 [tablecell.delegate didSelectRowAtIndexPath:(some way to determin touched row)]
}
like image 142
Bluephlame Avatar answered Sep 23 '22 10:09

Bluephlame