UITableView: Delay select recognition
UITableView: Delay select recognition
- Subject: UITableView: Delay select recognition
- From: Phillip Mills <email@hidden>
- Date: Thu, 27 Jan 2011 10:14:20 -0500
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.)
- 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.
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. (?)
---
( 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 (email@hidden)
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:
This email sent to email@hidden