我试图从另一个UIViewController中以模式的方式呈现UINavigationController的根视图。但是,当我单击触发模式转换的按钮时,我得到一个带有空UINavBar的空白屏幕。我怀疑我没有将视图附加到UINavigationController,但我不确定如何确切地做到这一点。
下面是我用来触发模式转换的target-action方法的代码。此代码包含在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];发布于 2012-10-21 12:07:32
我发现了问题所在。
我在rootViewController中声明了一个名为navigationController的属性。这将覆盖属于UIViewController父类的属性navigationController。把一切都搞砸了。
https://stackoverflow.com/questions/12985231
复制相似问题