Добавление строк в таблицу

У меня есть таблица с объектами, добавленными с помощью 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.

          }            
        }

Я не знаю, как поступить с функцией вставки, чтобы ввести новую строку при нажатии кнопки редактирования (в нижней части опубликованного кода). Заранее спасибо.


person MacUser    schedule 12.01.2012    source источник


Ответы (1)


Эти ссылки помогут вам вставить новую строку link1 ссылка2 ссылка3

person Balakrishnan Mca    schedule 12.01.2012