-1

私はUIImageこの方法で保存しています:

//save to file
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;

UIImage *imageToSave = newSize;
NSData *binaryImageData = UIImagePNGRepresentation(imageToSave);

[binaryImageData writeToFile:basePath  atomically:YES];

自分の名前 (myImage.png) を付けたいと思います。コードのどこに名前を挿入できますか? ありがとう 。

4

1 に答える 1

1

basePathアプリの Documents フォルダーのパスです。そのパスに画像ファイルの名前を追加する必要があります。

NSString *imagePath = [basePath stringByAppendingPathComponent:@"myImage.png"];

次に、もちろんそれを使用して、の代わりに画像を保存しますbaseImage

于 2012-09-26T16:04:38.823 に答える