すべての画像を含むカスタムディレクトリを作成します。なぜなら、設定のさまざまな場所で必要なときにイメージを取得するのに役立つからです。NSBundleを使用してカスタムディレクトリから画像ファイルを読み込みます。
NSFileManager *filemgr;
filemgr = [NSFileManager defaultManager];
[filemgr createDirectoryAtPath: @"/Users/home/lifemoveson/test" withIntermediateDirectories:YES attributes: nil error:NULL];
私は画像をテストフォルダの下に置き、.pngタイプです。 以下のような画像を取得する方法はありますか?
/**/
現在、このフォルダはPhotoscrollerの例のようにAPPLICATION_HOME /リソース/ ImageTiles /下で再び更新。 /Users/home/lifemoveson/test/ImageTiles/folderに変更するにはどうしたらいいですか?
- (UIImage *)tileForScale:(CGFloat)scale row:(int)row col:(int)col
{
// we use "imageWithContentsOfFile:" instead of "imageNamed:" here because we don't want UIImage to cache our tiles
NSString *tileName = [NSString stringWithFormat:@"%@_%d_%d_%d", imageName, (int)(scale * 1000), col, row];
// Currently this folder is under <Application_Home>/Resources/ImageTiles/ as per Photoscroller example.
// How can we change it to /Users/home/lifemoveson/test/ImageTiles/ folder ?
NSString *path = [[NSBundle mainBundle] pathForResource:tileName ofType:@"png"];
UIImage *image = [UIImage imageWithContentsOfFile:path];
return image;
}
解決方法はありますか?同じ問題に直面している – priya