Put webview URL in adress bar

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!

Answers


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


Need Your Help

gdb seg faults when reading symbols

c++ debugging memory gdb

When trying to run gdb with a program, it seg faults while reading symbols.

Can I use nested type in Scala generic function?

scala

How can I use nested type in Scala generic function ? I'd like to implement something like this

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.