关于WKWebView加载完毕的代理方法
2016-12-29 23:27
447 查看
现在在做一个项目,首页是原生的,然后页面上有10个左右的button,点击链接H5页面;
需求:在点击button的时候,当前页面出现loading动画,在H5页面加载完毕后跳转
我的思路:在button action的方法中,只是alloc init一个H5页面,在H5页面加载完毕的代理方法中发出Notification,然后在首页添加监听Notification,push页面.
button action的代码:
self.aniCoverView.hidden = NO;
self.gifView.image = [UIImage sd_animatedGIFNamed:@"aniGif"];
[YKBNotificationCenter addObserver:self selector:@selector(closeAnimation:) name:YKBCloseAniNotification object:nil];
hotelVC = nil;
hotelVC = [[YNHotelController alloc] init];
H5页面中加载完毕发送的Notification:
[YKBNotificationCenter postNotificationName:YKBCloseAniNotification object:nil userInfo:@{YKBURLString : self.urlString}];
首页监听Notification的方法:
NSString * tempString = notifi.userInfo[YKBURLString];
if ([tempString containsString:@"Flight/Search/"]) {
jiPiaoVC.hidesBottomBarWhenPushed = YES;
[self.tabBarController.parentViewController.navigationController pushViewController:jiPiaoVC animated:YES];
[YKBNotificationCenter removeObserver:self name:YKBCloseAniNotification object:nil];
}
现在有个问题:在跳转后页面会先白屏,然后才出现H5页面内容,怎样才能避过白屏,直接显示H5页面呢?跪求各路大神指点
需求:在点击button的时候,当前页面出现loading动画,在H5页面加载完毕后跳转
我的思路:在button action的方法中,只是alloc init一个H5页面,在H5页面加载完毕的代理方法中发出Notification,然后在首页添加监听Notification,push页面.
button action的代码:
self.aniCoverView.hidden = NO;
self.gifView.image = [UIImage sd_animatedGIFNamed:@"aniGif"];
[YKBNotificationCenter addObserver:self selector:@selector(closeAnimation:) name:YKBCloseAniNotification object:nil];
hotelVC = nil;
hotelVC = [[YNHotelController alloc] init];
H5页面中加载完毕发送的Notification:
[YKBNotificationCenter postNotificationName:YKBCloseAniNotification object:nil userInfo:@{YKBURLString : self.urlString}];
首页监听Notification的方法:
NSString * tempString = notifi.userInfo[YKBURLString];
if ([tempString containsString:@"Flight/Search/"]) {
jiPiaoVC.hidesBottomBarWhenPushed = YES;
[self.tabBarController.parentViewController.navigationController pushViewController:jiPiaoVC animated:YES];
[YKBNotificationCenter removeObserver:self name:YKBCloseAniNotification object:nil];
}
现在有个问题:在跳转后页面会先白屏,然后才出现H5页面内容,怎样才能避过白屏,直接显示H5页面呢?跪求各路大神指点
相关文章推荐
- android 关于webview 加载h5网页开启定位的方法
- iOS用WKWebView与JS交互获取系统图片及WKWebView的Alert,Confirm,TextInput的监听代理方法使用,屏蔽WebView的可选菜单
- WKWebView 获取标题+进度条+常用代理方法以及native兼容处理
- iOS用WKWebView与JS交互获取系统图片及WKWebView的Alert,Confirm,TextInput的监听代理方法使用,屏蔽WebView的可选菜单
- ios wkwebview的代理啊方法执行多次问题
- 关于用wkwebview加载沙盒documents下html文件 模拟器可以,真机不行的解决方案
- iOS11 WKWebView 无法加载内容的解决方法
- webView不加载,不进代理方法
- 关于安卓webview加载网页黑屏、部分黑屏或blank的解决方法
- 关于webview加载h5提示当前网站证书不可信的一些处理方法
- 判断webview加载完毕
- Asp.net Mvc 未能加载类型“System.Web.Mvc.ViewPage 的解決方法
- 关于android WebViewClient的方法解释
- 关于android WebViewClient的方法解释
- 关于webview 加载本地图片资源 显示不出来的解决办法
- 关于Android4.2后WebView的js方法需要加@JavascriptInterface
- 自己收集整理的关于 判断 网页是否加载完毕的方法(特别是多框架Frame),然后获取网页源码
- ASP.NET MVC2未能加载类型“System.Web.Mvc.ViewPage的解決方法
- Android中如何判别WebView加载完毕并使用ProgressDialog进行提示
- webview加载htmlstring里有工程里的图片解决方法