Youssef Moawad
Youssef Moawad

Reputation: 2866

UITableViewCell not showing checkmark accessory

I have a UITableView that gets shown when a button is tapped and it should display a checkmark accessory on a cell which is determined using a specific string from an array (the array that populates the table view) based on its index. I have the following code in the viewDidLoad method:

NSIndexPath *indexPath = [NSIndexPath indexPathWithIndex:[arrayOfSounds indexOfObject:currentSound]];
UITableViewCell *cell = [tableViewProperty cellForRowAtIndexPath:indexPath];
[cell setAccessoryType: UITableViewCellAccessoryCheckmark];

but some why it doesn't display the proper checkmark.
The currentSound variable is a string and it does have the correct text as I checked during debugging. Please advise!

Upvotes: 0

Views: 872

Answers (1)

JuJoDi
JuJoDi

Reputation: 14975

You should use the tableView's

- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation (UITableViewRowAnimation)animation;

to reload the cell.

Upvotes: 1

Related Questions