is it possible to handle touchbegin, moved, and ended in UIWindow as it is done in UIView? Is there a tutorial I could review?
+3
A:
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.
hotpaw2
2010-08-31 08:57:54
any tutorial please?
Mikhail Naimy
2010-08-31 09:05:27
+1
A:
Subclass your window from UIWindow
Then implement: touchesBegan,touchesMoved,touchesEnd functions
Meir Assayag
2010-08-31 09:49:58
+1
A:
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];
}
VdesmedT
2010-08-31 12:30:06
UIscrollview subclass means , please give explaination.....can i handle directly touch event in appdelegate.m file for UIwindow
Mikhail Naimy
2010-09-01 03:53:56
subclassing UIScrollView means create a class that inherit from UIScrollView like@interface myScrollView : UIScrollView {}@end
VdesmedT
2010-09-01 08:04:53