iPhoneでチャックボックスを実装したいとき

- (void)tableView:(UITableView *)_tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    switch (indexPath.section) {
        case 0:{
            UITableViewCell *cell = [_tableView cellForRowAtIndexPath:indexPath];
            
            //セルにチェックが付いている場合はチェックを外し、付いていない場合はチェックを付ける
            if (cell.accessoryType == UITableViewCellAccessoryCheckmark){
                cell.accessoryType = UITableViewCellAccessoryNone;
            }else{
                cell.accessoryType = UITableViewCellAccessoryCheckmark;
            }
            break;
        }
            
        default:
            break;
    }
    
    [_tableView deselectRowAtIndexPath:indexPath animated:YES];
}

こんな感じ。
ちなみに、case 0: { }
と括弧を付けないと、わけわかんないエラーをXcodeが報告する...........


参考:
セルにチェックマークを付ける - toshinoritoshinoriの日記