//
//  HomeAdViewController.m
//  ALand
//
//  Created by Z on 16/5/18.
//  Copyright © 2016年 Z. All rights reserved.
//

#import "HomeAdViewController.h"
#import <WebKit/WebKit.h>

@interface HomeAdViewController ()<WKNavigationDelegate>
@property (nonatomic, strong) WKWebView *webView;

@end

@implementation HomeAdViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, kWidth, kHeight - 64)];
    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.strUrl]]];
    self.webView = webView;
    webView.navigationDelegate = self;
    [self.view addSubview:webView];
    // Do any additional setup after loading the view from its nib.
}

#pragma mark - wkwebview delegate

// 页面开始加载时调用
- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation
{

    [MBProgressHUD showHUDAddedTo:self.view animated:YES];
}

// 页面加载完成之后调用
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
{
    self.title = webView.title;

    [MBProgressHUD hideHUDForView:self.view];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
