开发者

Handling touches

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

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)


I have managed to solve it by overriding the following method at the main window:

- (void)sendEvent:(UIEvent*)anEvent

I also check if it is the right event with through

if ([[[anEvent allTouches] anyObject] phase] == UITouchPhaseBegan)

I do the same for UITouchPhaseMoved and UITouchPhaseEnded, execute my custom code and then send [super sendEvent:anEvent];

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜