Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
439 views
in Technique[技术] by (71.8m points)

iphone - passing objective c variable to javascript in ios

How to pass a ObjectiveC string Variable to a javascript function? I have just started with javascript.. so plz 4give my ignorance...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
NSString * param  = @"foo";   
NSString * jsCallBack = [NSString stringWithFormat:@"myFunc('%@')",param];
[webView stringByEvaluatingJavaScriptFromString:jsCallBack];

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...