Encapsulate the WKWebView and quickly browse the web(Web container. WKWebView, UIWebView package)
This is a tool wrapper from WKWebView
that you can use to quickly load Url resources
// >>>>>>> init Model >>>>>>
LSWebObj *webObj = [LSWebObj new];
webObj.title = @"Test Title";
webObj.url = @"https://www.baidu.com";
self.title = webObj.title;
LSWebView *my = [[LSWebView alloc]initWithFrame:self.view.bounds];
[my loadURLString:webObj.url];
[self.view addSubview:my];
my.delegate = self;
#pragma mark - this is LSWebViewDelegate
- (void)lswebViewDidStartLoad:(LSWebView *)webview{
NSLog(@"The page starts loading...");
}
- (void)lswebView:(LSWebView *)webview shouldStartLoadWithURL:(NSURL *)URL{
NSLog(@"Intercept to URL:%@",URL);
}
- (void)lswebView:(LSWebView *)webview didFinishLoadingURL:(NSURL *)URL{
NSLog(@"The page is loaded!");
}
- (void)lswebView:(LSWebView *)webview didFailToLoadURL:(NSURL *)URL error:(NSError *)error{
NSLog(@"Loading error!");
}
Some implement logical references from ZLCWebView.