Guardar imágenes en dispositivo ios [cerrado]

Where can i store images from ios application programatically in ios simulator / device other than documents directory/ NSuserdefaults? Is there any way to store images in device photo album (to be done programatically)? Please suggest

preguntado el 25 de septiembre de 13 a las 09:09

4 Respuestas

You can save images to photo album using

UIImageWriteToSavedPhotosAlbum(UIImage *image, id completionTarget, SEL completionSelector, void *contextInfo);

Consulta la documentación aquí

Respondido el 25 de Septiembre de 13 a las 09:09

You can use cache directory for storing images. Data that can be downloaded again or regenerated should be stored in the <Application_Home>/Library/Caches directory.

Data that is used only temporarily should be stored in the <Application_Home>/tmp directory.

Read this for details Data storage Guidelines

Respondido el 25 de Septiembre de 13 a las 09:09

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

Respondido el 25 de Septiembre de 13 a las 09:09

This works fine. Can i name that image? I want to put a name and then save. - Shruti

no way to name the image - lanbo

If you do not need the image is published.. It should Store in Documents Folder. Users will not want that image nondescript has been saved to their photo album.

Respondido el 25 de Septiembre de 13 a las 10:09

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.