开发者

iPhone/iPad WebView Example

开发者 https://www.devze.com 2023-01-08 02:58 出处:网络
Where can I find a开发者_运维问答 simple compilable example on how to create and use a UIWebView?

Where can I find a开发者_运维问答 simple compilable example on how to create and use a UIWebView?

Any non-interface builder examples?


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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号