I have a UITableView and i can add and delete cells. I also have two buttons on each cell to add and subtract 1 from the cells text. But when i go to a different page and then back to the table view page, all the cells text is set back to 1. But i want the cell’s text to stay at the value that the user had set it to! Could someone help me? Im not sure what to do whatsoever. Thanks!
I have a UITableView and i can add and delete cells. I also have
Share
You will have to maintain an
NSMutableArray(probably ofNSIntegers) that saves the values of the cells. Then, whenever the user changes the value, update the value in the array. Also, display the cell label values by reading from the array. Sample codes below-If you want the values to persist even after the app is terminated and restarted, consider using CoreData.