hi,
i am working in creating a custom class which is subclass of UIWebview. But its delegate functions are not being called. How should i set delegate for this class. I know this is a basic question but it will be really good if some one could answer it. Thanks in advance.
My Code:
.h file
@interface PollackWebView : UIWebView<UIWebViewDelegate> {
}
-(id)initWebview:(CGRect)frame;
@end
.m file:
@implementation PollackWebView
-(id)initWebview:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
}
return self;
}
-(void)SetMyDelegate {
self.delegate = self;
}
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
NSLog(@"shouldStartLoadWithRequest");
if ( navigationType == UIWebViewNavigationTypeLinkClicked ) {
// do something with [request URL]
return NO;
}
return TRUE;
}
- (void)webViewDidStartLoad:(UIWebView *)webView {
NSLog(@"webViewDidStartLoad");
}