tags:

views:

14

answers:

1

i have table view and when user click on any row then he should go to next view but in my case its not working, what i am doing wrong here??

- (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




    }
+1  A: 

To fix your problem, try this:

- (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]; 
    }
Moshe
got it . i was using View-controller instead of navigation controller in app delegate now i changed and its working thanks
prajakta