开发者

Update table view cell label after returning from subview

开发者 https://www.devze.com 2023-02-14 21:28 出处:网络
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 fi

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号