WKWebView跳转后的页面URL获取处理。直接贴代码。
DDBWebViewController.h
//
// DDBWebViewController.h
// DDBIOS
//
// Created by liwx on 2018/3/14.
// Copyright © 2018年 io.lwx. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface DDBWebViewController : DDBViewController
@property (nonatomic, strong) NSString *urlString;
@property (nonatomic, strong) NSString *titleName;//标题
@end
DDBWebViewController.m
//
// DDBWebViewController.m
// DDBIOS
//
// Created by liwx on 2018/3/14.
// Copyright © 2018年 io.lwx. All rights reserved.
//
#import "DDBWebViewController.h"
#import <WebKit/WebKit.h>
@interface DDBWebViewController ()<WKUIDelegate,WKNavigationDelegate>
@property (weak, nonatomic)WKWebView *webView;
@property (nonatomic, strong) NSString *originUrlString;//原始URL
@end
@implementation DDBWebViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
WKWebView *web = [[WKWebView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:web];
[web mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.view);
}];
type