The way I'm reading your question, you want to intercept the events to trigger some action (animate toolbar, post notification), while allowing the event to also reach its natural destination.
If I were trying to do this, I would put the UIToolbar
directly as a subview of the UIViewController.view
. The UIWebView
remains a direct subview also.
The UIViewController.view
should be a subclass of UIView
, and it needs to override
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
The view can side-step being part of the event processing by sending back the view that you want to receive the event (UIToolbar or UIWebView), while you still get a chance to trigger the actions you want.
An example might be:
- (UIView *)hitTest:(CGPoint) point withEvent:(UIEvent *)event {
UIView* subview = [super hitTest:point withEvent:event];
/* Use the event.type, subview to decide what actions to perform */
// Optionally nominate a default event recipient if your view is not completely covered by subviews
if (subview == self) return self.webViewOutlet;
return subview;
}