您的位置:首页 > 移动开发

关于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页面呢?跪求各路大神指点
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: