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.
精彩评论