I have a simple program for iOS that contains numerous text fields. What I want is for the text in these fields (the user provides the input) to stay, even after switching screens. For example, if the user inputs “hello” in my text field and then segues to another screen, I want the word “hello” to still be in the text field if he returns to the screen again.
What is the best way to do this? Should I create a model, and everytime there is a segue, store the text in the fields to the model? Then if they segue back, reload the text?
If you require anything persistent then you should be storing this information in a model, that is controlled and synced with a view via a view controller. The text field should notify the view controller, and the view controller should update the model. Likewise, when the view controller is reloaded, it should update the view from the model.
This stuff can be done automatically with key/value binding.
I suggest doing a search for “model view controller design pattern ios” and “key value binding ios” in Google to get the information that explains this better. You’ll be a better Objective-C programmer for it, as Cocoa is based around the MVC (Model View Controller) paradigm.