[swift4] 特定のTableViewのCellだけ選択不可にしたい
特定のTableViewのCellだけ選択不可にしたい時は、セルにUITableViewCellSelectionStyle.noneを指定する
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell : UITableViewCell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath:indexPath) if indexPath.row == 1 { // セルの選択不可にする cell.selectionStyle = UITableViewCellSelectionStyle.none } else { // セルの選択を許可 cell.selectionStyle = UITableViewCellSelectionStyle.blue } return cell }