UITableView allowsSelection property for specific section
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.
精彩评论