2010-09-29 4 views
0

j'ai vue de la table et lorsque l'utilisateur cliquez sur une ligne, alors il devrait aller à la vue suivante mais dans mon cas son ne fonctionne pas, ce que je fais mal ici ??ne peut pas aller en détail vue de la table sur l'iphone

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 
     // Navigation logic -- create and push a new view controller 
     NSLog(@" push");// is working 

     aDetail = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:[NSBundle mainBundle]];// not wokring 




     [self.navigationController pushViewController:aDetail animated:YES];//not working 




    } 
+0

Que voulez-vous dire par ne fonctionne pas? Aussi, vous pouvez utiliser nil pour le nibName et bundle et il trouvera le bon fichier pour vous. – skorulis

+1

Quand vous dites "ne fonctionne pas", comment cela ne fonctionne-t-il pas exactement? Recevez-vous un avertissement ou une erreur du compilateur, un plantage, un écran vide ou rien ne se produit autre que l'instruction NSLog? –

Répondre

1

Pour résoudre votre problème, essayez ceci:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 
     // Navigation logic -- create and push a new view controller 

     // Don't forget to import DetailViewController.h at the top 
     // and then declare the type down here - see my revision to 
     // the beginning of the next line. (I also remove the bundle 
     // reference - it's not necessary as far as I know. 

     DetailViewController * aDetail = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil]; 
     [self.navigationController pushViewController:aDetail animated:YES]; 

     // Memory management - very important! 
     // The view is retained by your parent 
     // view, so you can and should release 
     // it here to avoid memory leaks. 

     [aDetail release]; 
    } 
+0

l'ai eu. J'utilisais View-contrôleur au lieu du contrôleur de navigation dans l'application délégué maintenant j'ai changé et son travail merci – prajakta

Questions connexes