Question

I am trying to present the rootview of a UINavigationController in a modal fashion from another UIViewController. However, when I click the button that triggers the modal transition, I get a blank screen with an empty UINavBar. I suspect I am not attaching a view to the UINavigationController, but I am not sure exactly how to do this.

Here is the code that I have for the target-action method that is supposed to trigger the modal transition. This code is included in the implementation file of the modal presenter:

    //Instansiate the root UIViewController 

        OzSoundSelectionViewController *selectionView = [[OzSoundSelectionViewController alloc]initWithNibName:@"OzSoundSelectionViewController" bundle:nil];

//Instansiate the UINavigatonController and set the root view controller

        navigationController = [[UINavigationController alloc]initWithRootViewController:selectionView];

//Set up the modal transition
        [selectionView setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
        [self presentModalViewController:navigationController animated:YES];
Was it helpful?

Solution

I figured out the problem.

I had a property declared in the rootViewController called navigationController. This overrode the property navigationController which is part of the UIViewController parent class. That screwed everything up.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top