ich das Überschreiben der Standard UITableViewSelectionStyle Derzeit UITableViewSelectionStyleNone
verwenden und dann die Farbe der Zelle basierend auf Delegatmethoden Wechsel:Entfernen UITableViewCell Auswahl
- (void)tableView:(UITableView *)tableView
didHighlightRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
[cell setBackgroundColor:[UIColor yellowColor]];
}
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
[cell setBackgroundColor:[UIColor whiteColor]];
}
- (void)tableView:(UITableView *)tableView
didUnhighlightRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"indexpath: %i",indexPath.row);
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
[cell setBackgroundColor:[UIColor whiteColor]];
}
- (void)tableView:(UITableView *)tableView
didDeselectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
[cell setBackgroundColor:[UIColor whiteColor]];
}
der Ausnahme, dass diese fast immer funktioniert, wenn ich eine Zelle markieren und dann ziehen meine Finger weg davon, ohne es tatsächlich auszuwählen, die Farbe ändert sich nicht zu Weiß ... wenn ich es auf [UIColor RedColor] setze, funktioniert es perfekt. Warum ist die ...
Edit:
Irgendwie, wenn ich den indexPath.row auszudrucken nach didUnhlightRowAtIndexPath ich "indexPath: 2147483647" von meinem NSLog
indexPath '2147483647' entspricht' NSNotFound'. – Malloc