Obecnie jestem nadrzędnymi standardowego UITableViewSelectionStyle za pomocą UITableViewSelectionStyleNone
a następnie zmianę koloru komórki w oparciu o metody Delegat:Usuwanie UITableViewCell Wybór
- (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]];
}
To prawie działa oprócz tego, że ilekroć zaznaczyć komórkę, a następnie przeciągnąć mój oderwij go bez wybrania, kolor nie zmieni się na biały ... jeśli ustawię go na [UIColor RedColor], działa perfekcyjnie. Dlaczego jest to ...
Edit:
Jakoś kiedy wydrukować indexPath.row po didUnhlightRowAtIndexPath otrzymuję "indexpath: 2147483647" Z mojego NSLog
indexPath '2147483647' jest równoważna' NSNotFound'. – Malloc