Reputation:
When a table cell is selected it gets highlighted in a blue color. I'd like to prevent this happening.
I tried doing this
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:NO];
}
But it goes blue for a second before the blue disappears. Is there a way I can avoid it appearing blue? I'd like to do something custom to the table cell instead.
Many Thanks, -Code
Upvotes: 2
Views: 672
Reputation: 1289
You can also specify the cell selection as none, blue or gray in the attributes inspector in xcode
Upvotes: 2
Reputation: 7226
UITableViewCell
has three selection styles:-
Blue
Gray
None
Implementation is as follows:-
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *) indexPath {
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
}
Upvotes: 4