Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-04-2010, 11:53 PM   #1 (permalink)
New iPhone-iPad Developer
 
Join Date: May 2010
Posts: 24
JuanMazuera is on a distinguished road
Smile TableView to reorder images in another view

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.

regards,
Juan
JuanMazuera is offline   Reply With Quote
Old 09-05-2010, 09:10 AM   #2 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

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.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 09-05-2010, 01:19 PM   #3 (permalink)
New iPhone-iPad Developer
 
Join Date: May 2010
Posts: 24
JuanMazuera is on a distinguished road
Thumbs up thanks

Quote:
Originally Posted by BrianSlick View Post
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?

thank you again for your help
JuanMazuera is offline   Reply With Quote
Old 09-05-2010, 09:15 PM   #4 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

new earth online / iPhone Development: Custom Classes
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 09-05-2010, 10:14 PM   #5 (permalink)
New iPhone-iPad Developer
 
Join Date: May 2010
Posts: 24
JuanMazuera is on a distinguished road
Thumbs up

Quote:
Originally Posted by BrianSlick View Post
thank you again, i'm looking to figure it out!
JuanMazuera is offline   Reply With Quote
Old 09-06-2010, 08:12 PM   #6 (permalink)
New iPhone-iPad Developer
 
Join Date: May 2010
Posts: 24
JuanMazuera is on a distinguished road
Red face

Quote:
Originally Posted by BrianSlick View Post
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?

i really appreciate your help. thanks
JuanMazuera is offline   Reply With Quote
Old 09-06-2010, 08:14 PM   #7 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,990
BrianSlick has a spectacular aura about
Default

You need to research how to save the data in your array.
__________________
BriTer Ideas LLC - Professional iOS App Development. Available for hire.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | Guide To Troubleshooting | Model Object Overview

Do you sit at a desk all day? Walk instead! Follow along with my treadmill desk adventures.
BrianSlick is offline   Reply With Quote
Old 09-06-2010, 09:14 PM   #8 (permalink)
New iPhone-iPad Developer
 
Join Date: May 2010
Posts: 24
JuanMazuera is on a distinguished road
Exclamation

Quote:
Originally Posted by BrianSlick View Post
You need to research how to save the data in your array.
...
aja, thats what i'm doing... thanks for your great tip
JuanMazuera is offline   Reply With Quote
Reply

Bookmarks

Tags
gallery, image, reorder, slideshow, tableview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 348
11 members and 337 guests
bignoggins, carlandrews, flamingliquid, hzwegjxg, ilmman, iram91419, linkmx, nadav@webtview.com, Objective Zero, stanny, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,656
Threads: 94,116
Posts: 402,889
Top Poster: BrianSlick (7,990)
Welcome to our newest member, iram91419
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 11:47 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0