0

I need a method like - (void)applicationDidFinishLaunching:(NSNotification *)aNotification but I need it for my WebView IBOutlet WebView*webView;. What is the right method?

Viper OS X
  • 291
  • 1
  • 5
  • 14

3 Answers3

3

You have a few different options with WebView, as there are around 5 informal delegates which you can implement methods to:

For example, you might want to implement the frame load and resource load delegates to monitor the load progress and display status messages. Applications that use multiple windows may want to implement a user interface delegate. See the individual informal delegate protocols for more details: WebFrameLoadDelegate Protocol Reference, WebPolicyDelegate Protocol Reference, WebResourceLoadDelegate Protocol Reference, and WebUIDelegate Protocol Reference.

I find WebFrameLoadDelegate to be the easiest, just set yourself as the delegate:

[webView setFrameLoadDelegate:self];

Then implement this method:

- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame

source: https://developer.apple.com/library/mac/documentation/Cocoa/Reference/WebKit/Classes/WebView_Class/Reference/Reference.html

radman
  • 71
  • 6
0
- (void)webViewDidFinishLoad:(UIWebView *)webView

It's in UIWebViewDelegate protocol.

danqing
  • 3,348
  • 2
  • 27
  • 43
  • Oh is that for OS X? Then it's the equivalent `webView:didFinishLoadForFrame:` in `WebFrameLoadDelegate`. – danqing Jul 31 '12 at 16:48
0

First Bound ResourceDelegate of webview with file Owner

(void)webView:(WebView *)sender resource:(id)identifier didFinishLoadingFromDataSource:(WebDataSource *)dataSource

This will work for me perfectly.

Jon Lin
  • 142,182
  • 29
  • 220
  • 220
Pooja Jalan
  • 604
  • 7
  • 9