Question

So I wanted to make my UIWebview respon to touch events. I have read several topics about this. I created a Subclass of UIWebView, added it so my UIViewController and linked it via IB. In my Subclass, i overrode touches ended and called [super touchedEnded]. didnt help. I overrode hittest, but it doesnt call super either!

If I add this code to my subclassed UIWebView:

@implementation UIWebView (CustomView)

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {

NSLog(@"hit");

return self; }

@end

then the touches ar forwarded to the superclass, but hittest is not(!)and additionally the webview stops scrolling.

Well, I want so recognize a touch in my webview and pass it to super - what am I doing wrong?

EDIT:

I'm wondering, why so many suggestions include using 'hittest' - this results in being unable to scroll your webview.....any ideas?

Was it helpful?

Solution

Answering my own question here - this is the version that did what I wanted: The right way. This is about subclassing UIWindow and passing on the events caught.

I would still love some explanations to my previous questions tho :P

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top