I have a UIViewController class, which has a button which triggers this:
DetailViewController *viewController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
[self.navigationController pushViewController:viewController animated:YES];
[viewController release];
Why does the push do nothing? If it matters, the UIViewController is within a UITabBarController.
My best guess for this in general is that you haven’t yet created a
UINavigationController. You need to create aUINavigationControllerfirst, then you can push onto the stack.You can check for this by using the
navigationControllerproperty to see whether the current viewController (self) is currently in aUINavigationController‘s hierarchy; if not , thenavigationControllerproperty returns nil.