3

When I click a cell it selects, but it stays blue on touch up. I want the blue highlight to leave on touch up (but it's important that it highlights in the first place).

This last answer in this post mentions something about willSelectRowAtIndexPath:, but I can't figure out how to use that to do what I want. Also, I do need didSelectRowAtIndexPath: to still be called, I just want the cell to unhighlight on touch-up.

1 Answer 1

6

Use the following where appropriate:

[tableView deselectRowAtIndexPath:indexPath animated:YES]; 

e.g. in didSelectRowAtIndexPath:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; } 

This will deselect the row at the specified index path.

You could also be interested in clearsSelectionOnViewWillAppear property in UITableViewController. If this property is set to yes then the controller clears the selection when the table appears. In default it set to YES.

Reference.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.