retain entries in UITableView
I have the following (view) controller arrangement:
an uitableview --(embedded in)--> navigation controller --(embedded in)--> Tab bar controller --(modal segue to)--> button in a view (uiviewcontroller).
description of my problem:
The view with the button is the initial view of my app. Pressing this button leads to a tableview in a tab bar. At the beginning the table view is empty, but you can manually add information on the cells, like names. However, once you go back to initial view (with button) and press the button again, the previous entries in the table view are erased.Can somebody give a hint how to retain these entries with the given arrangement. Thank you very much in advance.
You can use the singleton pattern. It will create a shared instance of your object, that you can access anywhere. You will then be able to write in it when the user adds a row in the table, and read it when you come to the tableView.
Here is a bit of help : Singleton pattern
EDIT : you can also use core data, but it may not be appropriate in your situation (plenty of docs on the web about that one)
This is quite a question as it really isn't about the interface per se. It is more to do with general Object Orientated Programming and the life time of objects.
Basically your data needs to be stored higher up the object hierarchy. It needs to persist across construction/destruction of the interface objects. This could also be done by storing the data in persist-able data store such as a DB or file but you would still need to store the means to extract the data or subset of data from the store.
If you wish to persist the data you could store data in a singleton data class and reference it statically or store it in your UIApplication object and pass that down the hierarchy as you create each object. you would probably have to subclass each object and add a new constructor passing in a ref to the data.