开发者

Disable iPhone table rows

开发者 https://www.devze.com 2022-12-11 04:09 出处:网络
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

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

精彩评论

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