Update table view cell label after returning from subview
i have a table view that when the user taps on one of the items it drills down to another table view. On this screen they select one of the items and the app pops the view bringing them back to the first screen. I want the item they selected to be displayed on the first table view.
EG. when you first run the app it says "please select 开发者_Go百科an item", you tap and select "item 1" , now the first table views cell has the "text item1" Thanks for any help you can offer.
PS. not sure if you can do this but could i update the cell label from the child view, so when i click "item1" it sets parent.cell.label (not correct code but you get the idea) to what item1 equals?
thanks
That should work. Another more robust way would probably be to update the UITableViewDataSource (so tableView:cellForRowAtIndexPath:
would return a cell with the new text) and then use the UITableView's reloadRowsAtIndexPaths:withRowAnimation:
method to cause the table view to reload that cell.
精彩评论