开发者

Disable iPhone table rows

Is there any way to disable the "selectibility" of a UITableView row?

开发者_高级运维Example: I would like to make an appointment for a haircut at a certain time with a certain stylist. What gets displayed to a user is a list of times in half hour increments, but unavailable times are grayed out/unselectable.


Yes, set the selectionStyle for any cells that shouldn't be selectable to UITableViewCellSelectionStyleNone.

Make sure to also set the cell's that should be selectable to UITableViewCellSelectionStyleBlue if you're using a reuseIdentifier on the cells.

You also need to override didSelectRowAtIndexPath so that cells with a UITableViewCellSelectionStyleNone style are ignored.


Implement:

- (void)tableView:(UITableView *)tv didSelectRowAtIndexPath:(NSIndexPath *)indexPath;

Do nothing inside of this method for rows that should be read only.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜