iosfreak
iosfreak

Reputation: 5238

How to hide UITableViewCellSelection after pressed?

I have a UITableView that in my cellForRowsAtIndexPath, I have this:

cell.selectionStyle = UITableViewCellSelectionStyleBlue;

However, after the action occurs in my UINavigationController and I go back, it's still selected. Also, I have a UIAlertView that pops up for one of my actions. How can I hide it after the user has finished tapping it.

Thanks

Upvotes: 0

Views: 111

Answers (2)

raid5ive
raid5ive

Reputation: 6642

Override the delegate method like so:

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

Upvotes: 2

dredful
dredful

Reputation: 4388

You can do this:

[yourTableView deselectRowAtIndexPath:[yourTableView indexPathForSelectedRow] animated:NO];

Upvotes: 1

Related Questions