tags:

views:

78

answers:

1

How do I save an image/photo in to the App?

I want to use the image as a background of my application and therefore would like the photo to be stored inside the application instead of the iphone photo library?

How would I accomplish this so I can use that image anytime in the application?

+1  A: 
  1. Get the path to your app's documents directory (if you don't know how to do that, there are dozens of questions on this topic here on SO).

  2. Assuming you are starting with a UIImage, convert it to a NSData instance with UIImageJPEGRepresenation() or UIImagePNGRepresetation().

  3. Save the data to the documents directory with -[NSData writeToFile:atomically:].

Ole Begemann