Is there any way for me to run some code when the WebView fully loads the page?
This is the code I’m using to open the web page in the view if this helps.
//Load URL Into WebView
NSString *urlAddress = @"http://example.com";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[[_listenupwebkit mainFrame] loadRequest:requestObj];
My .m file
- (IBAction)SignInButton:(id)sender {
//Load URL Into WebView
NSString *urlAddress = @"http://www.pandora.com/account/sign-in";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[_listenupwebkit setFrameLoadDelegate:delegate];
[[_listenupwebkit mainFrame] loadRequest:requestObj];
loginbutton.hidden = YES;
webkithome.enabled = YES;
}
And
- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame*)frame
{
if(frame == [sender mainFrame]) {
NSLog(@"viewDidLoad");
}
}
My .h file
- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame*)frame;
@end
Provide an implementation for
in your
frameLoadDelegate.In the method implementation, check to see if the finished frame is the main frame: