How to add Highcharts on UIWebView in iOS?

前端 未结 3 1417
旧巷少年郎
旧巷少年郎 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:13

    Useful code for calling .html in UIWebView.

    -(void)viewDidLoad
       {
         NSString *pathOfFile = [[NSBundle mainBundle]  pathForResource:@"chart" ofType:@"html"]; 
    
         NSString *htmlText =[NSString stringWithContentsOfFile:pathOfFile encoding:NSUTF8StringEncoding error:nil];
    
         NSURL *baseURL = [NSURL fileURLWithPath:pathOfFile];
    
        [UIWebView loadHTMLString: htmlText baseURL:baseURL];
       }
    

提交回复
热议问题