如今的App中有很多都是網(wǎng)頁內(nèi)嵌在App中的,今天就看看如何將網(wǎng)頁內(nèi)嵌進App.
1.創(chuàng)建一個webView的界面
2.獲取連接
3.獲取請求
4.調(diào)用請求
5.適配屏幕
UIWebView *webView = [[UIWebView alloc] initWithFrame:self.view.bounds];
NSURL *url = [NSURL URLWithString:@"http://www.douyu.com"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];
webView.scalesPageToFit = YES;
[self.view addSubview:webView];
非常簡單的代碼