真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

iOSHTML5的JS交互

 //webViewH5點擊交互走的代理  

成都創(chuàng)新互聯(lián)于2013年創(chuàng)立,先為芷江等服務建站,芷江等地企業(yè),進行企業(yè)商務咨詢服務。為芷江企業(yè)網(wǎng)站制作PC+手機+微官網(wǎng)三網(wǎng)同步一站式服務解決您的所有建站問題。

-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType

{

    NSURL * url = [request URL];

    NSString * urlStr = url.absoluteString;

    NSString * protocolPrefix = @"scheme";//和后臺定義好的字符  

    [self H5Js:protocolPrefix url:urlStr];

    return YES;

}

//數(shù)組分離參數(shù) 開始進行關鍵字提取以及相關操作

-(void)H5Js:(NSString *)protocolPrefix url:(NSString *)urlStr

{

    if ([[urlStr lowercaseString]hasPrefix:protocolPrefix])

    {

        urlStr = [urlStr stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

        NSArray * components = [urlStr componentsSeparatedByString:@":"];//以":"截取字符

        NSArray * shareUrl = [urlStr componentsSeparatedByString:@"?"];

        

//        NSLog(@"%@",components);

        NSString * prefix = components[1];

        if ([prefix isEqualToString:@"awardLogin"])

        {

            isReash = YES;

            [self jumpLogin];

        }

        if ([prefix isEqualToString:@"awardBindMobile"])

        {

            //綁定手機

            ModifyPhoneController * phone = [[ModifyPhoneController alloc]init];

                phone.title=@"綁定手機";

            [self.navigationController pushViewController:phone animated:YES];

        }

        if([prefix rangeOfString:@"awardShare"].location !=NSNotFound)

        {

            NSRange range1 = [urlStr rangeOfString:@"?"];//匹配得到的下標

            //        NSLog(@"rang:%@",NSStringFromRange(range));

            NSString *rangeStr =[urlStr substringFromIndex:range1.location+1];

            NSArray * parameter =  [rangeStr componentsSeparatedByString:@"&"];

            NSLog(@"%@",parameter);

            [dic setObject:[parameter[1] componentsSeparatedByString:@"="][1]  forKey:@"shareTitle"];

            [dic setObject:[parameter[2] componentsSeparatedByString:@"="][1] forKey:@"shareContent"];

            [dic setObject:[parameter[0] componentsSeparatedByString:@"="][1] forKey:@"shareImg"];

            [dic setObject:[parameter[3] componentsSeparatedByString:@"="][1] forKey:@"shareUrl"];

            NSRange range = [parameter[4] rangeOfString:@"="];//匹配得到的下標

            NSLog(@"rang:%@",NSStringFromRange(range));

            NSString *rangeStr1 =[parameter[4] substringFromIndex:range.location+1];

            [dic setObject:rangeStr1 forKey:@"smsContent"];

             [self share:nil];

        }

    }

}

//回調JS代碼

 NSString * str =[NSString stringWithFormat:@"lsf_login_callback(%@)",[User shareUser].userId];

        //評論完后刷新html5 頁面

        [self.webView stringByEvaluatingJavaScriptFromString:str];


當前文章:iOSHTML5的JS交互
分享路徑:http://weahome.cn/article/ipjsij.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部