Q:

iPhone - Extending UIWebViewDelegae protocol

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?

A:

You need to actually set your BrowserView object as the delegate of a UIWebView to get callbacks. You can't just declare yourself as conforming to the protocol and expect to get callbacks. E.g.:
BrowserView.m:
- (void)viewDidLoad {
    ...
    UIWebView *webView = [[UIWebView alloc] initWithFrame:self.view.bounds];
    webView.delegate = self;
    [self.view addSubview:webView];
    ...
}

