"The UIWebView class should not be subclassed." - from Apple's UIWebView
docs.
It sounds like you're trying to mess with how a person interacts with a web page, which is likely to get you rejected from the app store. (For a lot of possible rejection reasons, check out app rejected.)
If you're not worried about that, here is some advice that might help you achieve your goals:
- If you want to control where the user can and can't go via hyperlinks, or just perform some code whenever they click on some links, you can add a hook via the
webView:shouldStartLoadWithRequest:navigationType:
method of the UIWebViewDelegate
protocol. Very handy.
- If you want to perform some simple modifications to how the page acts or looks, you can essentially execute your own javascript in the page with a call to
stringByEvaluatingJavaScriptFromString:
, a method of UIWebView
itself. Just pass in your javascript as a string.
And, in case that doesn't give you want you want (in which case you're really going to tick off them app store review guys), then you can probably do what you're already doing, and just propagate all those UITouch
s right on through to the UIWebView
itself. Something like this, as an example (in the overlapping UIView
):
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
[self doWhatever];
[underlappingWebView touchesMoved:touches withEvent:event];
}
That way you can have your cake (get the user touch info) and eat it too (have the web page act as it normally does).