I am getting a weird compilation error - I dont know if there is a "ghost in the machine" or what?
Below if the code snippet where I am getting this error
   - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
    }
 cell.selectionStyle = UITableViewCellSelectionStyleNone;
 if (indexPath.section == 0) {
  switch (indexPath.row) {
   case 0:
    cell.textLabel.text = @"User";
    cell.detailTextLabel.text = @"John Smith";
    break; 
   case 1:
    cell.textLabel.text = @"From";
    cell.detailTextLabel.text = @"12/01/2010";
    break;
   case 2:
    cell.textLabel.text = @"To";
    cell.detailTextLabel.text = @"12/02/2010";
    break;
   case 3:
    cell.textLabel.text = @"Duration";
    cell.detailTextLabel.text = @"30 Days";
    break;
   case 4:
    UITextView *commentsView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 300, 44)];
    //commentsView.layer.cornerRadius = 10.0f;
    //[cell.contentView addSubview:commentsView];
    //[commentsView release];
    break;
   default:
    break;
  }
    } else if (indexPath.section == 1) {
  cell.detailTextLabel.text = @"Approve";  
 } else {
  cell.detailTextLabel.text = @"Reject";
 }
    // Configure the cell...
    return cell;
}
I am getting following error
/Users/dk/Desktop/xxx/Classes/DetailedLeaveRequestViewController.m:103:0 
/Users/dk/Desktop/xxx/Classes/DetailedLeaveRequestViewController.m:103: error: expected expression before 'UITextView'
at line
UITextView *commentsView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 300, 44)];
in the case 4:
I double-checked the syntax and everything over and over but could not find any problems. The weird part is when I tried to compile the line below last line of case 3: (just above the break;) it compiled and ran correctly. Can we not declare and initialize an object inside a case statement? Am I missing something fairly basic here?
Thanks.
 
     
    