Link to resources inside WebView - iPhone

前端 未结 10 1018
难免孤独
难免孤独 2020-11-27 14:28

I have a webview in my iPhone application, and I also have some html files inside my Resources folder. When my app loads, I load in a page from my resources into my webview.

10条回答
  •  孤街浪徒
    2020-11-27 15:24

    This code would return a string with the URL of a file named "OtherPage.html" in your bundle's resources directory.

    [[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"OtherPage" ofType:@"html"]] absoluteString]
    

提交回复
热议问题