Question regarding updating UITableViewCell on iPhone

I want to do something simple, like drilling on a specific UITableViewCell that calls the detail view controller. Inside, the user can change the attribute for the model under the cell. For example, if I display a list of quotes and the user clicks on the quote and the favorites click on the child controller, I want to be able to display an image that was hidden now that it was posted, possibly a star. What is the easiest way to update one specific UITableViewCell, for example, as a mod? Is it better to reference the selected UITableViewCell in the child controller and combine them this way? How it's done?

Thanks.

+3
source share
4 answers

It might be easier to just update the model object and then call [tableView reloadData];.

Then change your drawing code to reflect changes and display hidden images or something else.

+5
source

setNeedsLayout did it for me.

+2
source

For a complete code example, see the SQLite Books project on the ADC.

+1
source

To redraw a specific cell, you must find its rectangle (rectForRowAtIndexPath), then call setNeedsDisplayInRect in a UITableView with that rectangle.

-1
source

Source: https://habr.com/ru/post/1704834/


All Articles