UITableViewCell Accessory Type Sprawdzone na Tap & Set inne niezaznaczone

Trochę się mylę w kwestii akcesoriów do widoku tabeli ustawień.

Naprawiłem dwie sekcje w tabeli

DomGabinet

To, czego chcę, jest następujące ...

Gdy użytkownik dotknie dowolnej komórkiKomórka zostaje wybrana iChcę ustawić zaznaczone (ustawić typ akcesoriów uitableviewcell-sprawdzone z podsłuchanej komórki)A teraz wszystkie typy akcesoriów innych komórek powinny teraz być ustawione naOdpowiedni widok Typ akcesorium brak

Wypróbowałem następujący kod. Ale odkryłem, że indexpath.row i indexpath.section są właściwościami tylko do odczytu.

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

questionAnswers(9)

yourAnswerToTheQuestion