In this recipe, we will discuss displaying online content with the UIWebView
class.
Perform the following steps:
Open the
WebBrowserAppViewController.xib
file in Interface Builder and add aUIWebView
object on the main view. Create and connect an outlet for it with the namewebView
. Save the document.Override the
ViewDidAppear
method in theWebBrowserAppViewController
class, as shown in the following code:public override void ViewDidAppear (bool animated) { NSUrl url = new NSUrl ("http://software.tavlikos.com"); NSUrlRequest urlRequest = new NSUrlRequest (url); this.webView.LoadRequest (urlRequest); }
Compile and run the app on the simulator. Watch the website load on the screen!