【问题标题】:How to load a WebView on local files, but external to mainBlundle? (iPhone App)如何在本地文件上加载 WebView,但在 mainBlundle 外部? (iPhone 应用程序)
【发布时间】:2010-12-10 07:15:51
【问题描述】:

我编写了一个脚本,可以将一些 HTML 文件下载到我的应用程序的 Documents 文件夹中!我想在我的 WebView 中加载这些文件,可以吗?

例如: 如果 Documents 文件夹中存在 index.html,则加载它,否则在 mainBundle 中加载 index.html!

感谢大家可以帮助我!

【问题讨论】:

    标签: iphone webview


    【解决方案1】:

    当然,只需使用:

    [webview loadRequest: [NSURLRequest requestWithURL: [NSURL fileURLWithPath: [@"~/Documents/index.html" stringByExpandingTildeInPath]]]]

    【讨论】:

      猜你喜欢
      • 2018-01-25
      • 2023-03-10
      • 1970-01-01
      • 1970-01-01
      • 2017-03-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多