I am using switch statements in Objective-C, and when I nest a switch statement inside another switch statement, a lot of errors are being found by the compiler. So my general question is how do switch statements affect what methods I can call, and what type of behavior is causing the compiler to generate errors?
switch ([indexPath section]) 
{
    case 0:
        cell.textLabel.text = [infoKeysArray objectAtIndex:indexPath.row];
        CountdownFormatter *formatter = [[CountdownFormatter alloc] init];
        switch (indexPath.row) {
            case 0:
                cell.detailTextLabel.text = [formatter stringForCountdownInterval:taskInfo.duration];
                break;
            case 1:
                cell.detailTextLabel.text = [formatter stringForCountdownInterval:taskInfo.elapsedTime];
            default:
                break;
        }
        [formatter release];
        break;
    case 1:
        cell.textLabel.text = [actionsKeysArray objectAtIndex:indexPath.row];
        //NSArray *segments = [NSArray arrayWithObjects:@"Low", @"Medium", @"High", nil];
        switch (indexPath.row) {
            case 0:
                cell.detailTextLabel.text = priority;
                [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
                break;
            case 1:
                [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
                UISwitch *switch = [[UISwitch alloc] init];
                break;
            case 2:
                break;
            default:
                break;
        }
        break;
    case 2:
        cell.textLabel.text = [detailsKeysArray objectAtIndex:indexPath.row];
        break;
    default:
        break;
}
Here is where I am having issues. Why can I not declare a UISwitch inside this nested switch statement? I know I wrote [[UISwitch alloc] init] but the compiler is flagging it as an error. Any reason that would happen?
 
     
     
     
    