关于WKWebView加载完毕的代理方法

amlijlybo amlijlybo 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

现在在做一个项目,首页是原生的,然后页面上有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页面呢?跪求各路大神指点
...全文

相关推荐

评论 1
收藏 已收藏
分享
返回顶部
amlijlybo
iOS 29,038 成员 12,459 内容