本周学习使用WKWebView对网页进行托管
实现类似如下的效果
代码实现如下
#import “ViewController.h”
@interface ViewController ()
@property (nonatomic,strong)WKWebView * webView;
@end
@implementation ViewController
-
(void)viewDidLoad {
[super viewDidLoad];_webView = [[WKWebView alloc] initWithFrame:self.view.bounds];//初始化
NSMutableURLRequest * request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@“https://www.douban.com/doubanapp/dispatch/review/1253346”]];
[_webView loadRequest:request];
_webView.allowsBackForwardNavigationGestures = YES;
[self.view addSubview:_webView];
}