新建UIWebView

来源:互联网 发布:程序员做生意 编辑:程序博客网 时间:2024/04/30 11:53


 

CGRect webFrame = CGRectMake(0.0, 0.0, 320.0, 460.0); 

UIWebView *webView = [[UIWebView alloc] initWithFrame:webFrame]; 

[webView setBackgroundColor:[UIColor whiteColor]];

 NSString *urlAddress = @"http://www.google.com";

 NSURL *url = [NSURL URLWithString:urlAddress];

 NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; 

[webView loadRequest:requestObj]; 

[self addSubview:webView]; 

[webView release];