UITableView allows the Selection property for a specific section

Is there a way to set the allowSelection property for a UITableView for each section of the table separately, and not for the entire table?

+3
source share
2 answers

Does not look like it. Here's what you do: use the value of indexPath.section to set the cell .selectionStyleto UITableViewCellSelectionStyleNoneand return earlier from -didSelectRowAtIndexPath.

In other words, you will configure the cells of certain sectons so that they do not blink blue when they are selected, and when it is selected, to do nothing. It will be as if this section had the property allowsSelectionset to NO.

+6
source

Try using the willSelectRowAtIndexPath method and return zero for the section you do not want to allow.

+4
source

Source: https://habr.com/ru/post/1763986/


All Articles