UITableViewCell-Zubehörtyp Aktiviert bei Tippen und Anderes deaktivieren

Ich bin ein wenig verwirrt über Einstellungen Tabellenzubehör.

Ich habe zwei Abschnitte in meiner Tabelle festgelegt

ZuhauseBüro

Was ich will ist wie folgt ....

Wenn Benutzer auf eine der Zellen tippenZelle wird ausgewählt &Ich möchte ein Häkchen setzen (set uitableviewcell accessories type - Häkchen bei angezapfter Zelle setzen)Und auch der Zubehörtyp aller anderen Zellen sollte jetzt auf eingestellt seinuitable view cell Zubehörtyp none

Ich habe versucht folgenden Code. Aber ich fand, dass indexpath.row & indexpath.section schreibgeschützte Eigenschaften sind.

// Override to support row selection in the table view.
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {    
    [tblProfileView deselectRowAtIndexPath:indexPath animated:YES];
    int i,max;
    UITableViewCell *x; NSIndexPath *tt;

    for(i=0;i<[tblProfileView numberOfRowsInSection:0];i++)
    {
        tt.row=i; tt.section=0;
        x=[tblProfileView cellForRowAtIndexPath:];
        [x setAccessoryType:UITableViewCellAccessoryNone];
    }
    for(i=0;i<[tblProfileView numberOfRowsInSection:1];i++)
    {
        tt.row=i; tt.section=1;
        x=[tblProfileView cellForRowAtIndexPath:tt];
        [x setAccessoryType:UITableViewCellAccessoryNone];
    }

    x=[tblProfileView cellForRowAtIndexPath:indexPath];
    [x setAccessoryType:UITableViewCellAccessoryCheckmark];
    // Navigation logic may go here -- for example, create and push another view controller.
    // AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil];
    // [self.navigationController pushViewController:anotherViewController animated:YES];
    // [anotherViewController release];
}

Antworten auf die Frage(9)

Ihre Antwort auf die Frage