码迷,mamicode.com
首页 > 移动开发 > 详细

iOS WKWebView 使用笔记

时间:2015-08-25 13:31:04      阅读:1650      评论:0      收藏:0      [点我收藏+]

标签:

首先添加Webkit框架

技术分享

导入#import <WebKit/WebKit.h>

#import <WebKit/WebKit.h> 

@interface WebBrowerViewController ()<WKNavigationDelegate>

@property(nonatomic,strong) WKWebView *webView;

@end

@implementation WebBrowerViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self.view addSubview:self.webView];
    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.baidu.com"]]];
}


-(WKWebView *)webView
{
    if (!_webView) {
        _webView = [[WKWebView alloc] initWithFrame:self.view.bounds];
        _webView.navigationDelegate = self;
    }
    return _webView;
}


//1.1.1 页面开始加载时调用
-(void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation
{
    NSLog(@"页面开始加载...");
}

//1.1.2 当内容开始返回时调用
- (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation
{
    NSLog(@"内容开始返回...");
}

//1.1.3 页面加载完成之后调用
-(void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
{
    NSLog(@"页面加载完成...");
}

//1.1.4 页面加载失败时调用
-(void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error
{
    NSLog(@"页面加载失败...");
}

@end

 

iOS WKWebView 使用笔记

标签:

原文地址:http://www.cnblogs.com/sixindev/p/4756703.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!