【问题标题】:Acess files with the same name in Sub-Subdirectories访问子子目录中的同名文件
【发布时间】:2010-10-29 19:24:04
【问题描述】:

首先是我的结构:

Application
|---> dirA
    |---> dirB
        |---> index.html 
        |---> somefile.js
    |---> dirC
        |---> index.html 
        |---> somefile.js
    |---> dirD
        |---> index.html 
        |---> somefile.js

这里有一些问题。我需要在我的 webview 中加载这个不同目录的 index.html。但我不知道如何获取特定目录的 url,让我们说 dirB 在 dirA 中,我收到了Warning: Multiple build commands for output testo4.app/index.html 的通知。问题是,我无法重命名文件,因为我创建了子目录(真正的目录,不仅仅是来自 xcode 的“组”)

感谢所有提示!

【问题讨论】:

    标签: iphone objective-c ios uiwebview nsbundle


    【解决方案1】:

    如果是真正的目录,它们的路径应该是testo4.app/dirA/dirB/index.htmltesto4.app/dirA/dirC/index.htmltesto4.app/dirA/dirD/index.html,不是吗?

    文件在你的包中,你可以使用类似的东西

    NSString *path = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"index"] ofType:@"html" inDirectory:[NSString stringWithFormat:@"dirA/dirB/"]];
    

    比如dirB里面的那个。

    【讨论】:

      猜你喜欢
      • 2021-07-07
      • 1970-01-01
      • 2015-07-24
      • 1970-01-01
      • 2021-03-11
      • 2017-03-12
      • 1970-01-01
      • 2020-05-01
      相关资源
      最近更新 更多