I have a UIWebView in many UITableViewCell objects which live in a UITableView. When you try to scroll the UITableView, sometimes the touches will get "stuck" on the UIWebView objects. However, I still need to be able to click links within the UIWebView objects. So, I created a subclass:
#import "SecretWebView.h"
@implementation SecretWebView
-(UIView*)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
if ([[event allTouches] count] == 0) {
return self.superview;
} else {
return self; //I have tried many things here...
}
}
@end
My hope was that I could return the superview (i.e. the TableViewCell) when there wasn't a link being clicked, and then return whatever would normally be returned otherwise, so I can still click on links and get the same expected behavior. Everything works fine except for the "else" clause, where the UIWebView allows the link to be clicked.
In the code you'll see where I commented "I have tried many things here..." and that includes the following:
return [super hitTest:point withEvent:event];
return self;
return origObj; //where origObj was created in first line from the [super ...] call.
Please help me! How do I make it ignore any action but a single-tap on a link!?