Where can I find a simple compilable example on how to create and use a UIWebView?
Any non-interface builder examples?
UIWebView object is used the load and display the web content into your application, safari browser is the primary example for ios webview.
WKWebView replaces the UIWebView class in iOS 8 and later, and it replaces the WebView class in macOS 10.10 and later.
WebView is a generic name given to the browser like control available in any native mobile platforms set of tool to load web content from within in a native app.
Apple will no longer allow applications on the App Store that include the UIWebview control.
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
[webView setDelegate:self];
NSString *urlAddress = @"http://www.google.com/";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];
[self.view addSubview:webView];
WebView - Add the Delegate
@property (strong, nonatomic) IBOutlet UIWebView *WebView;
NSString *fullURL = @"http://facebook.com/";
NSURL *url = [NSURL URLWithString:fullURL];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[_WebView loadRequest:requestObj];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With