Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jagatnibas

macrumors regular
Original poster
Jul 28, 2008
126
0
i have a navigation bar based app, i was saving data while the view was going back by pressing back button successfully. now i need to display an alert and take confirmation to save. the problem i am facing is, when i press ok in alert, the view is popped up and data for saving is invalid causing a crash

how to fix this ?
 
i have a navigation bar based app, i was saving data while the view was going back by pressing back button successfully. now i need to display an alert and take confirmation to save. the problem i am facing is, when i press ok in alert, the view is popped up and data for saving is invalid causing a crash

how to fix this ?

Without code/crash log, I doubt anyone will be able to help.
 
i was saving data while the view was going back by pressing back button successfully.

This is the correct user experience on iOS.


now i need to display an alert and take confirmation to save.

This is the incorrect user experience on iOS.

On iOS there should be no disconnect between the viewed/edited data and the saved data. An iOS user should not have the concept of saved verses unsaved state. If an iOS user changes a field, it's the data that the iOS user is changing, not just an in-memory copy of the data. So it's wrong to ask the user if s/he wants to save the data, because it should be the data itself that the user has just edited. This model is now even extending to the desktop with Mac OS X Lion.
 
My 2c in addition to jiminaus:

The "back" button should take the user back to the previous view using the data as entered.

If an undo/confirm activity is required (for whatever reason :) ) I would suggest a Cancel and a Save button. "Cancel" to trigger the undo, "Save" to validate the new data and to close the view.

- Olaf
 
I also had a question about this. When I hit the back button that is when I save the data to a plist in my Documents folder in my sandbox. If I wanted to pass data from my ViewController (say an image ) that is getting destroyed to the previous ViewController to use, when I hit the back button, do I do that through the plist? dp I save it to the plist and retrive it from the plist, or is there a way to pass that data to the previous ViewController object?
 
You could store it with Singletons, call functions on your back to send it to the class that is above you in the navigation stack. .plists, SQLite (or CoreData).
etc. there are many options.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.