Updating a Tableview's Cells after creation

Discussion in 'iOS Programming' started by jchildress, Sep 4, 2008.

  1. jchildress macrumors member

    Jul 9, 2008
    I have a tableview with custom cells that I would like to update whenever I need too. For example, each cell has an extra UILabel on the right side of the cell that contains a value of a setting. When you tap that cell, it loads up a new view where you can change the value of that setting. When the modified setting is save by pressing the save button on this new view, and the navigation controller takes you back to the original (top) view, I want the original tableView to update the cell with the newly modified value.

    I think becuase the tableView code tries to save the cells to prevent them from being recreated, saving time and memory I assume, I think this is causing the cell to never update. Is there a method I can call to tell all cells or specific cells to update their Text\UILabels with the newly updated value?
  2. Luke Redpath macrumors 6502a

    Nov 9, 2007
    Colchester, UK
    You should be setting the contents for your cell each time tableView:cellForRowAtIndexPath: is called. If you update the source of your cell data then it should be updated automatically. What does your method look like?
  3. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    [UITableView reloadData] should cause everything to redraw. I assume you are setting the new value in your model object. The cells will be rebuilt with the new values.

    Look at the CustomTableViewCell sample in the TableView Suite examples.

Share This Page