how to pass local html files using array in xcode

前端 未结 1 448
广开言路
广开言路 2021-01-27 23:13

here i am trying for a application, when i click on the table view it will redirect to another page called details. there I have used a webview to dispaly the selected url value

相关标签:
1条回答
  • 2021-01-27 23:38

    try like this,take all the html file names in Array yourArray.

    NSString *htmlFile = [[NSBundle mainBundle] pathForResource:[yourArray objectAtIndex:selectedIndex] ofType:@"html" inDirectory:nil];
    NSString* htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];
    [WebView loadHTMLString:htmlString baseURL:nil];
    
    0 讨论(0)
提交回复
热议问题