在哪里可以以ios模拟器/设备编程来自ios应用程序的图像,而不是文件目录/ NSuserdefaults?有没有办法将图像存储在设备相册中(以编程方式完成)?请建议
答案 0 :(得分:3)
您可以使用
将图像保存到相册UIImageWriteToSavedPhotosAlbum(UIImage *image, id completionTarget, SEL completionSelector, void *contextInfo);
答案 1 :(得分:2)
您可以使用缓存目录存储图像。可以重新下载或重新生成的数据应存储在<Application_Home>/Library/Caches directory
。
暂时使用的数据应存储在<Application_Home>/tmp directory
。
答案 2 :(得分:2)
UIImageWriteToSavedPhotosAlbum
Adds the specified image to the user’s Camera Roll album.
void UIImageWriteToSavedPhotosAlbum (
UIImage *image,
id completionTarget,
SEL completionSelector,
void *contextInfo
);
Parameters
image
The image to write to the Camera Roll album.
completionTarget
Optionally, the object whose selector should be called after the image has been written to the Camera Roll album.
completionSelector
The method selector, of the completionTarget object, to call. This optional method should conform to the following signature:
- (void) image: (UIImage *) image
didFinishSavingWithError: (NSError *) error
contextInfo: (void *) contextInfo;
contextInfo
An optional pointer to any context-specific data that you want passed to the completion selector.
Discussion
When used with an image picker controller, you would typically call this function within your imagePickerController:didFinishPickingMediaWithInfo: delegate method implementation.
The use of the completionTarget, completionSelector, and contextInfo parameters is optional and necessary only if you want to be notified asynchronously when the function finishes writing the image to the user’s Camera Roll or Saved Photos album. If you do not want to be notified, pass nil for these parameters.
When used on an iOS device without a camera, this method adds the image to the Saved Photos album rather than to the Camera Roll album.
Availability
Available in iOS 2.0 and later.
See Also
UISaveVideoAtPathToSavedPhotosAlbum
答案 3 :(得分:0)
如果您不需要图片发布..它应该存储在Documents Folder中。 用户不希望将非声明图像保存到相册中。