ios使用webview浏览指定网页

#import "EDRViewController.h"

@interface EDRViewController ()
@property(nonatomic,weak) UIWebView * webView;
@end

@implementation EDRViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    UIWebView * webView=[[UIWebView alloc] initWithFrame:self.view.bounds];
    
    webView.backgroundColor=[UIColor redColor];
    
    [self.view addSubview:webView];
    self.webView=webView;

    [self loadRemoteHTML];
	// Do any additional setup after loading the view, typically from a nib.
}

#pragma mark 加载远程的HTML页面
- (void)loadRemoteHTML {
    NSURL *url = [NSURL URLWithString:@"http://www.baidu.com"];
    [self.webView loadRequest:[NSURLRequest requestWithURL:url]];
}

 

posted @ 2015-10-30 15:12  Ender.Lu  阅读(304)  评论(0编辑  收藏  举报