So basically I know that I can get all the selected cells using "selectedIndexPathRows". But I want to change behavior of cells which are not selected. Also I want to know which cells are not selected on didSelect or didDeselect . Basically, what I want to achieve is to get all the cells which are not selected and set their alpha to 0.5 and set 1.0 of only selected cells, how can I do that? Any help would be appreciated.
Asked
Active
Viewed 222 times
2 Answers
0
I'm giving hint for achieve that
- Take one array, size of array = total row of table
- Set initial value 0 at all index of array
- in
didSelectRowAtIndexPath
method first check, array has 0 value then change value 0 to 1 at specific index of array. - Now array has 0 value that means this rows are not selected.

iPatel
- 46,010
- 16
- 115
- 137
0
Easiest way to configure tableViewCell on select or deselect event. Only override 'setSelected' method in subclass of UITableViewCell.
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
if selected{
//configure on select
//alpha = 1.0
}else{
//configure on deselect
//alpha = 0.5
}
}

tailor
- 680
- 4
- 12