jDOG
jDOG

Reputation: 1201

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?

Upvotes: 13

Views: 33656

Answers (2)

Prithivi
Prithivi

Reputation: 101

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];

Upvotes: 1

gak
gak

Reputation: 32793

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];

Upvotes: 36

Related Questions