Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone/iPad WebView Example

Where can I find a simple compilable example on how to create and use a UIWebView?

Any non-interface builder examples?

like image 625
jDOG Avatar asked Jul 22 '10 00:07

jDOG


People also ask

Which of the following is an example of an iOS WebView?

UIWebView object is used the load and display the web content into your application, safari browser is the primary example for ios webview.

Does iPhone have WebView?

WKWebView replaces the UIWebView class in iOS 8 and later, and it replaces the WebView class in macOS 10.10 and later.

What is WebView iPhone?

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.

Does iOS allow WebView app?

Apple will no longer allow applications on the App Store that include the UIWebview control.


2 Answers

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];
like image 82
gak Avatar answered Oct 21 '22 00:10

gak


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];
like image 1
Prithivi Avatar answered Oct 20 '22 23:10

Prithivi