简体   繁体   中英

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 .

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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