Добавление динамических вложенных строк путем выбора строки просмотра таблицы в таблице ошибок iPhone?

Я хочу добавить строку динамически. У меня есть табличный список названий зданий. Если кто-то выбирает здание (didSelectRowAtIndexPath), то соответствующие этажи здания должны динамически добавляться как subrow. Это как максимизировать и минимизировать subrow при выборе соответствующего списка зданий. Как мне это сделать. Заранее спасибо...

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
// There is only one section.
if (tableView == indoortable || tableView == indoortable_iPad)
{
    return 1;
}
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section    {
// Return the number of time zone names.
if (tableView == indoortable || tableView == indoortable_iPad)
{
    return [indoorZones count];

}

}

Метод cellForRowAtIndexPath:

  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

if (tableView == indoortable || tableView == indoortable_iPad)
{
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView  dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) 
    {
        cell = [[[UITableViewCell alloc]  initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];

        cell.selectionStyle = UITableViewCellSelectionStyleGray;             //cell bg
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }       
    // Set up the cell.
    //cell.textLabel.text = [copyListOfItems objectAtIndex:indexPath.row];

    cell.textLabel.text =[indoorZones objectAtIndex: indexPath.row];
    //[cell setIndentationLevel:[[self.indoorZones objectAtIndex:indexPath.row] intValue]];
    return cell;
}
}

Метод didSlectRowAtIndexPath:

 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath   *)indexPath 
 {
zonesFloor = [[NSMutableArray alloc]init];
zonesFloorA = [[NSArray alloc] initWithObjects:@"Gr fl",@"1st fl",@"2nd fl",nil];

[zonesFloor addObject:zonesFloorA]; 
if (tableView == indoortable )
{

    NSUInteger i=indexPath.row+1;
    for (NSArray *count in self.indoorZones)  //app is crashing here giving  error.......Collection <__NSArrayM: 0x4b1d550> was mutated while being enumerated.
 {

        [zonesFloor addObject:[NSIndexPath indexPathForRow:i inSection:0]];
        [self.indoorZones insertObject:zonesFloor atIndex:i++];


    }

    [[self indoortable] beginUpdates];
    [[self indoortable] insertRowsAtIndexPaths:(NSArray *)zonesFloor  withRowAnimation:UITableViewRowAnimationNone];
    [[self indoortable] endUpdates];

    }


if (tableView == indoortable_iPad )
{

    //some logic
}

[tableView deselectRowAtIndexPath:selectedIndexPath animated:NO];
}

Выдает следующую ошибку [__NSArrayI сравнить:]: Или [NSIndexPath _fastCStringContents:]: нераспознанный селектор, отправленный экземпляру. Я пробовал много способов, но, может быть, мне чего-то не хватает. Пожалуйста, предложите. заранее спасибо.

Ответы на вопрос(2)

Ваш ответ на вопрос