简体   繁体   English

UITableView允许特定部分的选择属性

[英]UITableView allowsSelection property for specific section

有没有办法分别为每个表部分设置UITableView的allowsSelection属性,而不是整个表?

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 . 这里是你做什么:使用indexPath.section值来设置单元格的.selectionStyleUITableViewCellSelectionStyleNone并从提前返回-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. 换句话说,您将在某些sectinos中配置单元格,以便在选中时不闪烁蓝色,并且在选择时,不执行任何操作。 It'll be just as if that section had its allowsSelection property set to NO. 就好像该部分的allowsSelection属性设置为NO一样。

尝试使用willSelectRowAtIndexPath方法并为您不希望选择的部分返回nil。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM