4

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).

4thSpace
  • 43,672
  • 97
  • 296
  • 475

1 Answers1

1

See this question for the answer: Observing pinch multi-touch gestures in a UITableView

Community
  • 1
  • 1
Nimrod
  • 5,168
  • 1
  • 25
  • 39
  • 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 Jan 10 '10 at 06:13
  • 1
    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 Jan 10 '10 at 07:11