2012-01-12 7 views
0

listOfConjProcedures라는 NSArray가 추가 된 테이블이 있습니다. UInavigation 컨트롤러에서 편집 단추를 누를 때 테이블의 행을 테이블에 추가하기 위해 테이블의 맨 위 행 위에 나타나는 삽입 컨트롤을 사용하고 싶습니다. 좋은 샘플 코드를 찾을 수 없습니다. 편집 기능은 다음과 같습니다 :테이블에 행 추가

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{ 
    if ([tableView isEditing]) 
     return [listOfConjProcedures count] + 1; 
    else 
     return [listOfConjProcedures count];  
} 

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    if (editingStyle == UITableViewCellEditingStyleDelete) { 
     // Delete the row from the data source. 
     [listOfConjProcedures removeObjectAtIndex:indexPath.row]; 
     [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; 
    } else if (editingStyle == UITableViewCellEditingStyleInsert) { 
     // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view. 

      }    
     } 

내가 편집 버튼 (게시 된 코드의 맨 아래) 탭하면 새 행을 소개하는 삽입 기능을 수행하는 방법을 모르겠어요. 미리 감사드립니다.

답변

1

이 링크를 삽입 새 행에 대해 당신을 도와줍니다 link1link2link3

관련 문제