Note that there are some explanatory texts on larger screens.

plurals
  1. POSelecting the same UITableViewCell for the 3rd time will not highlight and add accessoryCheckmark
    primarykey
    data
    text
    <ol> <li><p>The code below works when I want to highlight and put a check mark next to the selected cell.</p></li> <li><p>It also works when I want to select another cell as it deselects the last cell or highlight and puts a check mark and highlight next to the new selected cell.</p></li> <li><p>It also work when I reselect a selected cell as it deselects it leaving no check mark and highlight in the UITable.</p></li> <li><p>However, when I select the the same cell for the third time (meaning, I first selected it, the code highlighted it and put a checkmark next it. I selected the same cell the 2nd time, and it removed the highlight and the checkmark, it is now the third time I'm selecting the same cell) it highlights the cell for a fraction of a second and than the highlight disappears. The checkmark next to the cell also never shows up as if I had just deselected it. No matter how many times I select the same cell, it does not highlight it or put a check mark next to it. The only way to accomplish this is to select another cell first, and then reselect the original cell. Please help.</p> <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath { // select new UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath]; cell.accessoryType = UITableViewCellAccessoryCheckmark; [cell setSelected:TRUE animated:TRUE]; // deselect old UITableViewCell *old = [self.tableView cellForRowAtIndexPath:self.lastSelected]; old.accessoryType = UITableViewCellAccessoryNone; [old setSelected:FALSE animated:TRUE]; // keep track of the last selected cell self.lastSelected = indexPath; } </code></pre></li> </ol> <p>I built the UITableView via Storyboard. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload