iOS与H5之间的交互之点击事件的捕捉
2016-11-30 15:21
225 查看
- (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;
}
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;
}
相关文章推荐
- iOS 与HTML5交互之捕捉HTML5按钮点击事件,获取webview上按钮的点击事件
- iOS 与HTML5交互之捕捉HTML5按钮点击事件,获取webview上按钮的点击事件
- IOS和H5之间的交互开发
- iOS开发,UIWebview与H5之间的交互
- ios捕捉移动view的点击事件
- h5中的input keyup触发事件在ios中需点击键盘换行才执行
- ios h5 app avalon tap点击事件失效及点击延迟300ms问题解决方法
- ios h5 点击事件失效及点击延迟
- iOS开发--UIWebview与H5之间的交互
- iOS开发,UIWebview与H5之间的交互
- iOS webView 和 H5 页面交互(点击获取H5页面中的按钮,做自己想做的操作)
- android中捕捉menu按键的点击事件
- 捕捉浏览器关闭、刷新事件(a.点击关闭按钮 b.任务栏右击关闭 c.按alt+F4关闭)
- ios UIButton的点击与松开事件处理
- IOS为UIImageView图片添加点击事件
- iOS 捕捉home事件
- IOS---UIView添加点击事件
- ios 关于 通过加载 xib 生成的view,调用 addsubviews,sub view的按钮 不相应点击事件的 问题
- iOS - 让view触发点击事件
- Axure RP 6.5学习记录(6)-事件交互-在登录表单点击登录按钮跳转到首页