I need to get a URL from UIWebView and put it in the address bar. I used this code, but it doesn't work at all.
- (void)webViewDidStartLoad:(UIWebView *)webView2 shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType{
NSURL *URL = [request URL];
[webAdress2 setText:[URL absoluteString]];
}
Please help!
I've had a similar problem today. Apparently the [request URL] only gets value after the webView has finished loading. So I made a property in the controller with a webView so that I could set a value for it from the class which calls that controller and then just used something like:
[webAdress2 setText:self.theURL];
Hope it helps