Reputation: 12500
i am developing an sample app where i have N number of custom button with images present in the screen.I can able to perform following operation(drag drop,rotate,change color etc.)upon these buttons.
I can also able to draw line on the screen.
So now i want to persist these data so that on restart of application i can able to see my previous objects.What is the best solution to do this?
Upvotes: 0
Views: 198
Reputation: 119242
You've got three options, all pretty simple:
In all cases you'll need to transform your data into property list type format (strings, numbers, data, dictionaries, arrays). User defaults would be frowned on if you had a large amount of data. Core data could be overkill. A plist is probably your best bet on the information you have given.
You'll need to store your data either each time it changes or when the application goes into the background, and restore it if needed on launch. I say if needed, because if you are just resuming from background, everything may still be present if iOS hasn't sent you any memory warnings or closed you down.
Upvotes: 1
Reputation: 1219
Core Data. Use a managed object to represent each button with attributes like "color","position_x", "position_y", etc.. use sqlite as the persistent store.
Upvotes: 0