简体   繁体   中英

Send message to UITableViewCell from UITableViewController

I have designed a table view in my storyboard that uses many interface elements. For example, I have a cell with a UIStepper in it, and a cell that segues to another modal view. It contains static cells, as it is a simple data entry form and creating new UITableViewCell objects for each field would be a waste of time. However, I am using one custom cell from another point in the program. I have assigned the cell to be an instance of my custom UITableViewCell class, and have set the label and image view from the code (the custom cell is basic; two UILabels and a UIImageView ). I set a placeholder image in the viewWillAppear method. The cell displays fine at first, however, when I change the label's text or the image in the code, the cell does not refresh until I tap it. I read that using custom table view cells was the solution to this problem when it occurred with basic UITableViewCells , however, this does not seem to solve my problem. Is there a method I can declare in custom cell that reloads the cell when the data is changed? If so, how?

Thanks!

更新了单元格后面的数据源中的信息(即图像或文本)后,应在UITableView上调用reloadRowsAtIndexPaths:withRowAnimation:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM