Ho un UIPanGuestureRecognizer aggiunto l'intera vista utilizzando questo codice:Get scorri per eliminare l'UITableView a lavorare con UIPanGestureRecognizer
UIPanGestureRecognizer *pgr = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panAction:)];
[[self view] addGestureRecognizer:pgr];
All'interno della vista principale Ho un UITableView che ha questo codice per attivare il colpo a eliminare caratteristica:
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"RUNNING2");
return UITableViewCellEditingStyleDelete;
}
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.row >= _firstEditableCell && _firstEditableCell != -1)
NSLog(@"RUNNING1");
return YES;
else
return NO;
}
Solo RUNNING1
viene stampato il registro e il pulsante Elimina non si presenta. Credo che la ragione di questo sia UIPanGestureRecognizer, ma non ne sono sicuro. Se questo è corretto come dovrei andare a risolvere questo. Se ciò non è corretto, fornire la causa e correggere. Grazie.
Avete impostare la classe di essere delegato del visualizzazione della tabella? – rdelmar
@rdelmar Sì. Inoltre, non penso che RUNNING1 sarebbe stampato se non lo facessi. Ma grazie per aver provato. – carloabelli
canEditRorAtIndexPath: è un metodo di origine dati, non un metodo delegato, pertanto verrà eseguito se non è stato impostato il delegato. – rdelmar