Вставить строку в UITableView - чего-то не хватает - PullRequest
1 голос
/ 19 апреля 2011

Мне нужно добавить ячейку 'ADD NEW ROW' в таблицу.И я добавляю это, но у меня есть проблема, чтобы закончить это.В этом методе setEditing я не знаю, что мне нужно поместить в массив paths?

-(void)setEditing:(BOOL)editing animated:(BOOL)animated {
    [super setEditing:editing animated:animated];
    [self.tableView setEditing:editing animated:animated];
    //[self.tableView reloadData];

    NSMutableArray* paths = [[NSMutableArray alloc] init];

    // fill paths of insertion rows here

    if( editing )
        [self.tableView insertRowsAtIndexPaths:paths withRowAnimation:UITableViewRowAnimationBottom];
    else
        [self.tableView deleteRowsAtIndexPaths:paths withRowAnimation:UITableViewRowAnimationBottom];

    [paths release];
}

1 Ответ

2 голосов
/ 19 апреля 2011

Вы должны добавить объекты indexPath в этот массив путей. Вы можете создать экземпляр NSIndexPath как -

NSIndexPath *indexPath = [NSIndexPath indexPathForRow:1 inSection:0];
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...