3

I am developing one application. In that I want to save my pictures in camera roll. So how to save my pictures in camera roll through code?

Cœur
  • 37,241
  • 25
  • 195
  • 267
user777021
  • 75
  • 2
  • 8

2 Answers2

10

The most basic way (and the only way if you're targeting iOS before 4.0) is to use UIImageWriteToSavedPhotosAlbum. This lets you specify a selector to be called on a target object when the save is complete.

In 4.0, you can use ALAssetsLibrary's writeImageToSavedPhotosAlbum:orientation:completionBlock: to write the image; in this case, you provide a block to be called when the save is complete.

In 4.1, you can also use ALAssetsLibrary's writeImageDataToSavedPhotosAlbum:metadata:completionBlock: or writeImageToSavedPhotosAlbum:metadata:completionBlock: to write an image along with metadata (e.g. geotagging information). The former is also the only way to write an image from an NSData object without first loading it as a UIImage or CGImageRef.

Anomie
  • 92,546
  • 13
  • 126
  • 145
1

See this blog post..UIImageWriteToSavedPhotosAlbum is your friend..

Krishnabhadra
  • 34,169
  • 30
  • 118
  • 167