开发者

UITableView allowsSelection property for specific section

开发者 https://www.devze.com 2023-01-15 17:22 出处:网络
is there a way to set the allowsSelection property of UITableView for each table section separately, and not for the whole tabl开发者_如何学运维e ?Doesn\'t look like it. Here\'s what you do: use the i

is there a way to set the allowsSelection property of UITableView for each table section separately, and not for the whole tabl开发者_如何学运维e ?


Doesn't look like it. Here's what you do: use the indexPath.section value to set the cell's .selectionStyle to UITableViewCellSelectionStyleNone and to return early from -didSelectRowAtIndexPath.

In other words, you'll configure cells in certain sectinos to not flash blue when selected, and when it IS selected, not to do anything. It'll be just as if that section had its allowsSelection property set to NO.


Try using the willSelectRowAtIndexPath method and return nil for the section you don't want to allow selection on.

0

精彩评论

暂无评论...
验证码 换一张
取 消