is it possible to handle touchbegin, moved, and ended in UIWindow as it is done in UIView? Is there a tutorial I c开发者_JAVA技巧ould review?
Look at Apple's documentation for the UIResponder class. A UIWindow descends from the UIResponder class, thus can optionally handle all UI events, including touch events, for contained UIViews.
Pay attention that if any View added to the window capture the event and doesn't forward it, the window object will never receive it. UIScrollView typically does that. In that case, you also need to subclass the blocking view to forward the event like this for example :
in a UIScrollView subclass :
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
if (!self.dragging) {
[self.nextResponder touchesEnded: touches withEvent:event];
}
[super touchesEnded: touches withEvent: event];
}
Subclass your window from UIWindow
Then implement: touchesBegan,touchesMoved,touchesEnd functions
精彩评论