- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{
NSString *requestString = [[[request URL] absoluteString]stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSLog(@"requestString : %@",requestString);
NSArray *components = [requestString componentsSeparatedByString:@"|"];
NSLog(@"=components=====%@",components);
NSString *str1 = [components objectAtIndex:0];
NSLog(@"str1:::%@",str1);
NSArray *array2 = [str1 componentsSeparatedByString:@"/"];
NSLog(@"array2:====%@",array2);
NSInteger coun = array2.count;
NSString *method = array2[coun-1];
NSLog(@"method:===%@",method);
if ([method isEqualToString:@"InviteBtn1"])//查看详情,其中红色部分是HTML5跟咱们约定好的,相应H5上的按钮的点击事件后,H5发送超链接,客户端一旦收到这个超链接信号。把其中的点击按钮的约定的信号标示符截取出来跟本地的标示符来进行匹配,如果匹配成功,那么就执行相应的操作,详情见如下所示。
{
UZGCustomAlertView *vc= [[UZGCustomAlertView alloc]initWithTitle:self.detailTitle];
vc.showImage = NO;
[vc show];
return NO;
}else if ([method isEqualToString:@"InviteBtn2"]) { _shareVw = [ShareView defaultShareView]; [_shareVw setShareContentWithTitle:self.title1 content:self.title2 shareImage:[UIImage imageNamed:@"share.jpg"] shareURL:self.url2]; [_shareVw show]; [_shareVw setShareViewBlock:^(BOOL isSuccess) { if (isSuccess) { NSLog(@"分享成功"); }else { NSLog(@"分享失败"); } }]; [_shareVw setShareViewCopyBlock:^(BOOL isSuccess) { if (isSuccess) { NSLog(@"复制链接成功"); }else { NSLog(@"复制链接失败"); } }]; return NO; } return YES; }