I've got 2 viewControllers: WebviewViewController and AnotherViewController. And here is mainWebView on WebviewViewController. I delegate mainWebView to WebviewController. And this works perfect:
- (void)webViewDidFinishLoad:(UIWebView *)webView{
NSLog(@"Finish upload");
}
Then I create UIWebView for AnotherViewController.
@interface AnotherViewController : UIViewController <UIWebViewDelegate> {
IBOutlet UIWebView *Webview;
}
Link Webview with webView from WebviewController in interfaceBuilder. And try to use delegate method in AnotherViewController class.
- (void)webViewDidFinishLoad:(UIWebView *)Webview{
NSLog(@"NIIIIIICE!");
}
Result:
2011-10-14 13:54:46.363 TakeInputs[4558:207] Finish upload
I understand that it's so stupid but I'm stacked. I want to use delegate methods in two classes.
you need to link your AnotherViewController to your webview like below in viewdidload of AnotherViewController
webview.delegate = self
that's it, now your delegate method should be in AnotherViewController.m file