开发者

How to only make one cell selectable

In my normal tableview I got a bunch o开发者_开发技巧f switches and segments, and I don't want them to be selectable, so I set:

tableView.allowsSelection = FALSE;

Now one of the cells, I want to point to a new view, and thereby make it selectable. But there's no cell.allowSelection or anything, how do I solve this? How do I make it, so that it can be pushed and direct you to another view? I don't want them all to be selectable, since that's ugly...


There is not an allowsSelection property on cells, but there is a similiar property.

Set cell.selectionStyle to UITableViewCellSelectionStyleNone for cells you don't want to the user to be able to select.

(You will have to set table.allowsSelection back to YES.)

Configured this way, you'll still get -tableView:didSelectRowAtIndexPath: for any cell the user taps; just ignore it for cells that you don't intend to be selectable. (Thanks tc.)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜