iOSWKWebView的简单使用

本周学习使用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];
    }

发布了34 篇原创文章 · 获赞 4 · 访问量 720

猜你喜欢

转载自blog.csdn.net/weixin_44824650/article/details/103219591