2

UIWebViewに.js(javaScript)ファイルをロードしたいのは次のような1つの関数だけではありません

 [webView stringByEvaluatingJavaScriptFromString:@""];
4

1 に答える 1

3
NSString *javaScript=[NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"javascript" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil];

[webView stringByEvaluatingJavaScriptFromString:javaScript];

[1] http://www.iphonedevsdk.com/forum/iphone-sdk-development/22703-loading-local-javascript-file-into-uiwebview-problem.html

[2] http://iphoneincubator.com/blog/windows-views/how-to-inject-javascript-functions-into-a-uiwebview

于 2012-04-30T06:48:53.047 に答える