1

I am struggling to apply a workaround I found regarding UIWebView accepting tap-events. Source:

http://mithin.in/2009/08/26/detecting-taps-and-events-on-uiwebview-the-right-way/

. The author reminds the reader that he has to implement a '-userDidTapWebView' method, which is declared in a protocol. I don't know where and how to implement this method in order to obtain the desired result. So, I am kindly asking you for help. Thanks in advance for the patience of looking into this!

1 Answer 1

1
@protocol TapDetectingWindowDelegate
- (void)userDidTapWebView:(id)tapPoint;
@end

This declares a protocol (interfaces in Java/C#/D term), which the adopting class must implement the content of the protocol (i.e. the -userDidTapWebView: method.)

Later in the page,

@interface WebViewController : UIViewController<TapDetectingWindowDelegate>

The <…> means the WebViewController class is adopting the TapDetectingWindowDelegate protocol. Therefore, this class must fulfill the restrictions imposed by this adoption, i.e. the WebViewController must implement -userDidTapWebView:.

The implementation is done in the @implementation, e.g.

@implementation WebViewController
- (void)userDidTapWebView:(id)tapPoint {
    NSLog(@"User tapped web view at point %@.", tapPoint);
}
@end
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.