リソース (青いフォルダー) をリソース バンドルに追加しましたが、NSFileManger を使用してファイルが存在するかどうかを判断し、チェックで使用されたフル パスを出力するかどうかを確認するところまで、すべて問題ないようです。 :
NSString *p = [NSString stringWithFormat:@"%@/words/001",
[[NSBundle mainBundle] resourcePath]];
NSFileManager *fm = [NSFileManager defaultManager];
NSString *a = [p stringByAppendingPathComponent:@"001-1.png"];
UIImage *i;
if ([fm fileExistsAtPath:a]) {
NSLog(@"file found ... %@", a);
i = [UIImage imageWithContentsOfFile:a];
}
else {
NSLog(@"doh!");
}
[iv setImage:i];
ファイルの存在チェックからこの出力を取得します
/Users/phh/Library/Application Support/iPhone Simulator/4.2/Applications/3DAB4772-7251-4E39-8EA8-4AFE32DFB61A/MyApp.app/words/001/001-1.png
しかし、UIImage は常に nil ですか? 私はここで何が起こっているのか見ることができません....
ヘルプ....?
ありがとう