Reputation: 957
I have a UIViewController with a calendar and below it is a UITableView with a UITableViewCell that has a series of UIButtons that I change the button text depending on the data that I retrieve. When a date is selected I update a NSArray and call [self.tableView reloadData]. The first row populates as it should, the UIButton titles show the correct data. The rest of the rows show the default values for the UIButtons from the storyboard. If I scroll a cell off the screen and let it come back it displays the correct data (i.e. updates the titles of the UIButtons). I'm not sure why this is happening. I tried adding [cell setNeedsLayout] before the cell is returned but it has not helped.
Upvotes: 0
Views: 93
Reputation: 2082
Are you modifying the testLabels directly? UIButtons have iffy behavior sometimes if you do. Try using the UIButton methods to change the textLabel's properties, such as setTitle: forState:
Upvotes: 2