UITableView Setting some cells as “unselectable”

后端 未结 16 1489

How can I set the UITableView\'s cell property to be unselectable? I don\'t want to see that blue selection box when the user taps on the cell.

16条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-12 18:25

    Use tableView: willDisplayCell: forRowAtIndexPath: instead of tableView: didSelectRowAtIndexPath: to get rid of the flash that appears first time you touch the cell.

    - (void) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
    {
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    

提交回复
热议问题