How to add Highcharts on UIWebView in iOS?

前端 未结 3 1421
旧巷少年郎
旧巷少年郎 2021-02-06 14:33

I am totally new to HighCharts and I referred example http://blog.li-labs.com/developing-ios-apps-with-custom-charting/ and tried same, but on iPad simulator I am getting a blan

3条回答
  •  长发绾君心
    2021-02-06 15:29

    I tried the suggestions in this post and couldn't get the HighChart load.

    The problem ended up being the "loadHTMLString" call. Passing nil for the baseURL was incorrect. Here's what worked for me - I needed to pass the actual baseURL:

    NSString *htmlFile = [[NSBundle mainBundle] pathForResource:url ofType:@"html"];
    NSString* htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];
    
    NSURL *baseURL = [NSURL fileURLWithPath:htmlFile];
    
    [webView loadHTMLString:htmlString baseURL:baseURL];
    

提交回复
热议问题