views:

205

answers:

2

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

Any non-interface builder examples?

A: 

There's an example here that uses IB minimally... There's also this one, which uses only code.

Robert Karl
@robert - do you have an example that is minimal objective-C and mostly C++? I am way more proficient there
jDOG
unfortunately, i think most high level APIs for iOS are all Objective-C... but C++ is supported by default in an iPhone project in files with the extension .mm
Robert Karl
A: 
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];
Gerald Kaszuba