Search code examples
objective-cxcode4uinavigationcontrollernavigation

its not navigating to the class


I am writing the following code in a button click event and i am trying to navigato the class PDFReaderViewController, but on click of the button its not navigating, can anybody tell me y

UINavigationController *addNavigationController;
PDFReaderViewController *avController = [[PDFReaderViewController alloc] initWithNibName:nil bundle:nil];

    if(addNavigationController == nil)
{
        addNavigationController = [[UINavigationController alloc] initWithRootViewController:avController];
    addNavigationController.navigationBar.tintColor = [UIColor blackColor];
    addNavigationController.navigationBar.alpha=0.7f;
    addNavigationController.navigationBar.translucent=YES;


    [self.navigationController presentModalViewController:addNavigationController animated:YES];
}

Solution

  • What you are actually looking for? In your code you are trying to present a navigationController from another navigation controller.

    To present a vieController as a modelViewController you don't need a custom NavigationController.You can present it simply by:

    PDFReaderViewController *avController = [[PDFReaderViewController alloc] initWithNibName:nil bundle:nil];
    [self.navigationController presentModalViewController:avController animated:YES];
    [avController release];