IOS打开一个本地html,怎么给他带上一个参数

如题所述

本地文件不可以url直接加参数,可以在uiwebview 加载好后 用js和oc 交互,传递参数。

参考:

 NSURL *urlNosmoke = [NSURL URLWithString:[NSString stringWithFormat:@"nosmokeProgram.html"]];
    
    NSString *strFilePath = [self.viewController.commandDelegate pathForResource:[urlNosmoke path]];
    
    NSURL *urlNonSmoking = [NSURL URLWithString:@"?nonSmokingId=2013" relativeToURL:[NSURL URLWithString:strFilePath]];
    
    NSURLRequest *req = [[NSURLRequest alloc] initWithURL:urlNonSmoking
                                              cachePolicy:NSURLRequestUseProtocolCachePolicy
                                          timeoutInterval:20.0f];
    
    [self.viewController.webViewEngine loadRequest:req];

温馨提示:答案为网友推荐,仅供参考
第1个回答  2016-09-12
使用ios中的jsapi调用

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网