I am trying to change the size of a webView when the website changes. What I need is to check the UIWebview's URL to see if it matches the one I am looking for. Or just changes at all.
views:
39answers:
1
+1
Q:
Is there a method somewhere supplied by Apple which will trigger when a UIWebView changes pages?
+2
A:
If you implement the UIWebViewDelegate protocol in your view controller, you can handle the following message:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
and get the URL as a string:
NSString * urlString = request.URL.absoluteString;
Update
Make sure you set the delegate property on the UIWebView.
Cannonade
2010-07-29 02:25:23
So would this also make sense?Because it does not say hit- (void)webViewDidFinishLoad:(UIWebView *)webView{ NSLog(@"HIT"); }
Michael Amici
2010-07-29 02:36:52
are you setting yourself as a delegate on the UIWebView?
Cannonade
2010-07-29 02:43:06
Thats it. Thank you!
Michael Amici
2010-07-29 02:47:09
@michael-amici Happy to help. If this answer was helpful, you can upvote and/or click accept answer. :)
Cannonade
2010-07-29 02:59:01