How to call JavaScript Function in objective C

后端 未结 5 1695
借酒劲吻你
借酒劲吻你 2020-12-01 04:09

I am new programmer to objective C. I added some html file to Objective C. In this html file contains simple javascript function. I need to call that Function through thw ob

5条回答
  •  南笙
    南笙 (楼主)
    2020-12-01 04:23

    Try this:

    NSString *jsCallBack = [NSString stringWithFormat:@"setPhoto('%@')",profileImgPath];
    
    [webView stringByEvaluatingJavaScriptFromString:jsCallBack];
    

提交回复
热议问题