我正在尝试使用该函数在 html 页面中调用 javascript -
View did load function
{
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *writablePath = [documentsDirectory stringByAppendingPathComponent:@"BasicGraph.html"];
    NSURL *urlStr = [NSURL fileURLWithPath:writablePath];
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSString *myPathInfo = [[NSBundle mainBundle] pathForResource:@"BasicGraph" ofType:@"html"];
    [fileManager copyItemAtPath:myPathInfo toPath:writablePath error:NULL];
    [graphView loadRequest:[NSURLRequest requestWithURL:urlStr]];
}
- (void) webViewDidFinishLoad:(UIWebView *)webView
{
    [graphView stringByEvaluatingJavaScriptFromString:@"methodName()"];
}
这是 html 页面上的 javascript -
<script>
    function methodName()
      {
         // code to draw graph
      }
但是,该函数methodName()没有被调用,但在 window.onload = function () 之后一切正常..
我正在尝试将RGraphs集成到我的应用程序中,并且Basic.html是编写 javascripts 的 html 页面。
如果有人能帮我解决这个问题,那就太好了。