Hinzufügen von dynamischen Unterzeilen durch Auswahl der Tabellenansichtszeile in der Tabellenansicht iPhone-Fehler?

Ich möchte die Zeile dynamisch hinzufügen. Ich habe eine Tableview-Liste mit Gebäudenamen. Wenn jemand ein Gebäude auswählt (didSelectRowAtIndexPath), sollten die entsprechenden Stockwerke des Gebäudes dynamisch als Unterzeile hinzugefügt werden. Dies entspricht dem Maximieren und Minimieren der Unterzeile in der jeweiligen Gebäudelistenauswahl. Wie mache ich das. Danke im Voraus...

- (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-Methode:

  - (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-Methode:

 - (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];
}

Es gibt folgenden Fehler [__NSArrayI compare:]: Oder [NSIndexPath _fastCStringContents:]: Unbekannter Selektor an Instanz gesendet. Ich habe viele Möglichkeiten ausprobiert, aber vielleicht fehlt es mir irgendwo. Bitte vorschlagen. Danke im Voraus.

Antworten auf die Frage(2)

Ihre Antwort auf die Frage