On Saturday, June 05, 2010, at 05:51PM, "WT" <jrca...@gmail.com> wrote: >I need to hijack the set of touch events sent to a UITableView instance prior >to allowing the table to process those events. > >I have a custom UIView, of which the table view is a subview, and I override >-hitTest:withEvent: there (in the custom view) to return self, thereby >preventing the table from receiving those touches. > >Since my custom view does not implement any of the four event-handling methods >(-touchesBegan:withEvent:, etc), the view controller managing my custom view >gets the touches, through the regular traversal of the responder chain. > >There, in the view controller event-handling methods, I determine whether or >not I need to consume the events. If not, I need to send them back to the >table view for it to do its normal event handling (for instance, scrolling). > >All of the above works fine, except...
Probably not as "fine" as you expect - UIViews are not designed to support UIEvents forwarded to them except under very controlled conditions. From <http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/EventHandling/EventHandling.html#//apple_ref/doc/uid/TP40007072-CH9-SW17>: "The classes of the UIKit framework are not designed to receive touches that are not bound to them; in programmatic terms, this means that the view property of the UITouch object must hold a reference to the framework object in order for the touch to be handled. If you want to conditionally forward touches to other responders in your application, all of these responders should be instances of your own subclasses of UIView." That document contains a number of suggestions on how to approach those sort of design issues... _______________________________________________ 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