Hello everybody, i've been trying to solve this like a week ago, and i have had no results, so I'm here to share my problem with all of you and hope somebody can help me.
i'm building an app which include the possibility to add a user customized photo slideshow, so the user adds the images he wants.
as the images are added they are saved and named (pic 1, pic 2, pic 3, etc.) it also saves a small reference of the image (icon 1, icon 2, icon 3, etc), when the images load, it loads in order (first, icon 1, second icon 2, etc) and adds a tag number to each one (icon 1 (tag 1) icon 2 tag 2, etc) and with a tap on an image it loads the big image according to the tag number (if tag 3, loads pic 3).
so far so good.
now i'm trying to add an interface to rearrange those images, with a table view. now the table view is loading the icon images in order (icon 1 icon 2 icon 3 etc) and actually i'm able to rearrange those images in the table view (icon 3, icon 1, icon 2 etc), BUT I hit done when editing the table view, it keeps the new order, but when i go back to previous view and go back to editing it is loaded in original order again (icon 1, icon 2, icon 3, etc)
now my question is, what is the best option i have to keep that new order saved always. I'm new to xcode, and i don't know what is the best option i have to save that images order, and when it loads the slideshow it will with the new order. the same thing if i delete an image. What is the best option? with xml? plist? sqlite? renaming? i would really appreciate any kind of help or point to a solution.
Create a custom object: ImageInfo or something like like that. This would include the following properties:
- path to image
- path to icon
- sort order
- anything else that would be useful
Keep these objects in an array. Use that array to populate the tableview. If the user reorders, change the appropriate value. Save the array.
Create a custom object: ImageInfo or something like like that. This would include the following properties:
- path to image
- path to icon
- sort order
- anything else that would be useful
Keep these objects in an array. Use that array to populate the tableview. If the user reorders, change the appropriate value. Save the array.
hello BrianSlick, thanks for your response, i really appreciate it, you have the best answer for everything, your responses in other threads, helped me a lot.
i'm relatively new to xcode, so I don't know exactly how to create a custom object.
I am populating the table view with a NSMutableArray of images, loaded from an array with the images paths, how do i change that to objects, and add the info you tell me? if i add that info to an array, does that saves the info for when the app is closed and opened again?
when do i change the value of the new position. actually i have tableView:moveRowAtIndexPath:toIndexPath: and it tells me what row the image was and the new row, but if i move the 8th image to the 2nd position i have to change not only image 8 and 2 but also 3, 4, 5 and so on... what do you think?
hi. i'm trying this and it's kind of working but theres nothing that saves the positions like in a file or something, and when the app is closed and opened again it has the old info, not the new.
how to keep a reference to the position of the image always, and save when stops editing and load when the app is closed and opened again?