1
を特定のファイルのパスを取得する方法、私はこれらのいずれかを使用しています標準ディレクトリ内の項目をlocalitieするには、IOSに
NSURL* url = [[NSBundle mainBundle] URLForResource:@"search" withExtension:@"png"];
NSString *path = [[NSBundle mainBundle] pathForResource:@"search" ofType:@"png"];
出力は次のようになります。
url is file://localhost/Users/myName/Library/......./MyApp.app/search.png
path is /Users/myName/Library/......./MyApp.app/search.png
違いそれらの2つの間には、不足しているfile://localhost
です。
ご質問はいつURLForResource
を使用し、pathForResource
を使用する必要がありますか?
感謝をURLに変換することができ、ティム – tranvutuan