Luke Roberts
Luke Roberts

Reputation: 311

Remove Animation When Selecting A Cell In A Tableview

I have a to do list app and the user is able to tap onto a cell to cross out the task.

However, when tapping on the cell, for a brief moment, the whole cell goes gray to indicate it has been selected.

Is there any way to completely remove this animation so that when the cell is tapped, it still registers as a tap but there is no selection animation.

So far I just have

tableView.deselectRow(at: indexPath, animated: false)

but the animation flashes up briefly.

Any help would be appreciated :)

Upvotes: 2

Views: 4645

Answers (2)

SPatel
SPatel

Reputation: 4956

just set cell's selection style to none

Upvotes: 0

Ashley Mills
Ashley Mills

Reputation: 53231

Just set

cell.selectionStyle = .none 

and your cell will still be selectable, but you won't see the background colour change

You can also set this in a storyboard.

Upvotes: 12

Related Questions