views:

233

answers:

1

I have a UIViewController inside of a navigation based app. I'd like the view controller to receive all touch events from child objects, such as a tableview and navigation bar. Or, any other technique that is able to intercept all touch events.

Right now, the following never executes inside of the view controller:

 - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event

I need to check a class level flag inside of the touch event, no matter where the touch came from (within any of the view's children).

+2  A: 

See this question for the answer: http://stackoverflow.com/questions/2003201/observing-pinch-multi-touch-gestures-in-a-uitableview/2003781#2003781

Nimrod
That works well. I wasn't able to use it the way described in that post. I added the new class and just check for anything in its (void)sendEvent:(UIEvent *)event. I couldn't get it to work by implementing into any other classes, as the post mentions.
4thSpace
So you set window.eventInterceptDelegate to point to your controller and interceptEvent: wasn't called in your controller? Only the window will get the sendEvent: message from the UIApplication, that's why you have to use delegation to "pass the message on" to some other instance if you need something done there.
Nimrod