0
我有一個表與對象添加與NSArray調用listOfConjProcedures我想要使用插入控件出現在表中的頂部行上方以添加行到我的表時添加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.
}
}
我不知道如何使用插入功能開始介紹新行,當編輯按鈕被點擊(在發佈代碼的底部)。 預先感謝您。