2010-04-27 4 views
0

la méthode délégué n'appeléEn utilisant la méthode méthode « editingStyleForRowAtIndexPath », « didSelectRowAtIndexPath » n'est pas appelé

-(void)viewWillAppear:(BOOL)animated 
{ 
    [theTableView setEditing:TRUE animated:TRUE]; 
} 


-(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    return UITableViewCellEditingStyleDelete; 
} 

en téléphonant au-dessus des méthodes je vais obtenir moins composant avant chaque cellule de tableau.

Mais la méthode ci-dessous didSelectRowAtIndexPath n'est pas appelée et l'indicateur de disclouser n'est pas visible.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    [theTableView deselectRowAtIndexPath:indexPath animated:YES]; 
    ContactEditViewCotroller *contactEditViewCotroller=[[ContactEditViewCotroller alloc]init]; 
    contactEditViewCotroller.isEdit=isEdit; 
    if(isEdit == YES) 
    { 
     for(int i=0; i<=[editObject.contactList count]-1;i++) 
     { 
      if(indexPath.section == i) 
      { 
       appDelegate.isAddInEdit=NO; 
       editcontacts = [editObject.contactList objectAtIndex:i]; 
       contactEditViewCotroller.editcontacts=editcontacts; 
       indexRow=i; 
      } 
     } 
    } 
    else 
    { 
     for(int i=0; i<=[addContactList count]-1;i++) 
     { 
      if(indexPath.section == i) 
      { 
       appDelegate.isAddInEdit=NO; 
       Contacts *obj = [addContactList objectAtIndex:i]; 
       contactEditViewCotroller.addcontacts=obj; 
      } 
     } 
    } 
    [[self navigationController] pushViewController:contactEditViewCotroller animated:YES]; 
    [contactEditViewCotroller release]; 

} 

Répondre

2

Méthode didSelectRowAtIndexPath sera appelée lorsque vous définissez allowsSelectionDuringEditing à TRUE.

La valeur de allowSelectionDuringEditing détermine si les utilisateurs peuvent sélectionner des cellules lorsque le récepteur est en mode d'édition.

Set comme ceci:

tableView.allowsSelectionDuringEditing = YES; 
Questions connexes