views:

107

answers:

1

Hey.

I'm loading in a UIWebView from another class, and that works great.

But now I need to know how I can implement these delegate methods:

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
// AND:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex

I have tried to do it in the other class, but that did not work. I also tried it in the class that fills/loads data into the UIWebView, but that didn't work either. I have set the UIWebView-referance in the .h-files, and everything should work, but it doesen't.

Any help will be appreciated. Thanks ! :)

+2  A: 

After you create the UIWebView in your "other class" (aka UIViewController) you need to set the delegate of the UIWebView to the object that implements the delegate protocol methods. This is typically the controller that created the webView.

Take a look at the UICatalog sample project files WebViewController.h|m for hints as to how this should be done.

falconcreek
Ah, forgot about that!
Emil