views:

55

answers:

1

I have a UIView subclass with several subviews and I want to handle these events in the class:

  • touchesBegan:withEvent:
  • touchesMoved:withEvent:
  • touchesEnded:withEvent:

but I also want these event to be called at the subviews. How can I accomplish that?

(I have already tried with hitTest, but I only get the touchesBegan event and no touches are send with the method)

A: 

I have managed to solve it by overriding the - (void)sendEvent:(UIEvent*)anEvent method at my main window. I check if it is the right event with if ([[[anEvent allTouches] anyObject] phase] == UITouchPhaseBegan) (same for UITouchPhaseMoved and UITouchPhaseEnded), do what I have to do at my class and then send [super sendEvent:anEvent];

dkk