I have 5 background images for my app. I want that the user can select one. I am looking for the best way to hold them in my app, so that my app is able to loop over them and show them to the user as he clicks "next image". Any ideas?
views:
107answers:
3You could just put them as individual files in your project. There are no benefits to throw everything into DB.
save it actual image on the iphone file system in the user's document folder. save any meta data info about the images (like tags, location, etc) in a sqlite database. link the database entries to the images via some key (perhaps the image file name)
then all you need to do is read this data from sqlite, populate it in nsarray collection and loop through it when user clicks next / previous
do note that only load the images when really required (when user is requesting for it) as images tend to eat up a lot of precious memory
Create a plist in the application and store the last-selected-image when the user selects the image. Next time when you reload the application, read this plist and display the image accordingly.
Sqlite would not give any advantage in your case, I feel. Package all 5 images in your .app (dont copy it to the Documents folder, unless you are going to change the image or add a new ones to the list).