I’m using the following code to extend the web view delegate.
@protocol CustomWebViewDelegate <UIWebViewDelegate>
@optional
-(void)touchesEnded;
@end
In my class I’m implementing web view delegates:
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
- (void)webViewDidFinishLoad:(CustomWebView *)webView
- (BOOL)webView:(CustomWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:
My Interface declaration is as following:
@interface BrowserView : UIViewController <UITextFieldDelegate, UIWebViewDelegate, UIScrollViewDelegate, CustomWebViewDelegate>
The problem is that its not calling the delegates of web view. why?
Where is my code wrong?
You need to actually set your
BrowserViewobject as the delegate of aUIWebViewto get callbacks. You can’t just declare yourself as conforming to the protocol and expect to get callbacks. E.g.:BrowserView.m: