To read out the URL of what a Web View is currently displaying we can use this method: NSURL *myURL = [[NSURL alloc]init]; myURL = self.myWebView.request.URL.absoluteURL; Or, if we’d like to retrieve this as a string: myString = self.myWebView.request.URL.absoluteString;
If you’re conforming to the UIWebViewDelegate protocol the webView:didFailLoadWithError: method gets triggered when there has been a problem. Call it like this and display an error message (in this case a UIAlertView): This method is also a good opportunity to stop any loading animations you’ve got going.
It’s always good to have something happening while you’re loading a UIWebView. You can use the UIActivityIndicator for this. It’s basically an animated GIF file that you can connect to your code like many other elements. To make it work we need to conform to the UIWebViewDelegate protocol and then query our web view to […]
Everything has to be that bit more complicated with iOS doesn’t it?