views:

21

answers:

1

I have this code to show a nib on click of row index

    UIViewController *controller = [[ShowFavViewController alloc] initWithNibName:@"ShowFavViewController" bundle:nil];
    [self.navigationController pushViewController:controller animated:YES];
    self.navigationController.navigationBarHidden = NO;
    NSLog(@"here");

but its not showing ShowFavViewController.xib file, although its showing "here" in log. what i am doing wrong?

A: 

My first bet would be that self.navigationController is nil (because the currently-displayed view controller is not a direct child of a navigation controller), or controller is nil (because there was an error during initialization). Check both of those first.

Ed Marty
Yes self.navigationController is nil. What to do now? How to achieve my desired functionality?
coure06
Do you, in fact, have a navigation controller on the screen? Or do you just have a view controller with a navigation bar as part of the view? You will have to use a UINavigationController as the direct parent of the view if you want to use self.navigationcontroller. Otherwise, if you can access the navigation controller through some other object, do that.
Ed Marty