On Jan 27, 2011, at 7:14 AM, Phillip Mills <phillip.mil...@acm.org> wrote:

> I would like to have either an action occur that's linked to a double-tap in 
> a UITableViewCell subclass *or* the action specified by the 
> ...didSelectRowAtIndexPath:... method of the owning UITableView, but not 
> both.  I've encountered some problems with each approach I've tried.
> 
> - Having the table's select method perform an action after a delay and ask 
> the cell whether it should *really* do it sort of works but is a bit scary 
> since it depends on the length of delay.  (I really don't like things that 
> only function if a timing window is always valid.)
> 
> - Obviously, pulling out the table's gesture recognizer and setting up 
> dependencies is a bad idea, mostly because that recognizer isn't documented, 
> but also because it's not the cell that's recognizing its own selection.  
> (Having the table depend on the failure of all its cells sounds overly 
> complex.)

What is this gesture recognizer you speak of pulling out of the table view? 
Table view does not use gestures for selection, but you're right that even if 
it did, you shouldn't mess with it. 

> 
> - I had one idea that seemed promising for a while.  Creating both a 
> single-tap and a double-tap recognizer for the cell does prevent the table's 
> select method from being called.  My theory was that perhaps I could use...
>        [singleTap requireGestureRecognizerToFail:doubleTap];
> ...in the cell and *somehow* trigger the table's select only if the 
> single-tap succeeded.  Unfortunately (and unexpectedly!) putting that 
> dependency on the single-tap stopped it from blocking the table's select.

A single tap by itself would fire before the table gets a chance to process any 
touches. By adding the failure requirement you allow the table to get touch 
events when the gesture doesn't fire immediately. 

> 
> At this point, my feeling is that maybe I should handle both single and 
> double taps in the cell -- with the dependency, send a custom notification 
> for the table to use when single succeeds, and do nothing in the table's 
> normal select cell logic.  OTOH, I also feel that this must be a common 
> requirement and therefore easier than I'm making it appear.  (?)

Have you tried just having a double tap gesture and doing everything there? 
Perform one action on the succeed case and another on the failure case. 

> 
> ---
> 
> ( It would be so much easier to not fight with the framework if the framework 
> was a little less hostile.  I think I'm seeing one violation of the 
> "Principle of Least Astonishment" for every two hours of work that I do with 
> it.  :) )
> 
> _______________________________________________

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to