【发布时间】:2013-11-17 14:22:19
【问题描述】:
当用户按下主视图控制器上的按钮时,我以编程方式显示模态视图控制器。我遇到的问题是模态视图显示时没有导航栏。
我怎样才能让栏出现?请找到我的代码,让我知道缺少什么或错误:
-(void)appInfoButtonPressed:(id)sender {
infoViewController *iVC=[[infoViewController alloc] init];
self.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentViewController:iVC animated:YES completion:nil];
UINavigationController *navBar = [[UINavigationController alloc] initWithRootViewController:iVC];
[self presentViewController:navBar animated:YES completion:nil];
}
另外,在尝试关闭模态视图时,我打算使用以下行:
[self dismissViewControllerAnimated:YES completion:nil];
我应该将此行包含在主视图控制器的方法中还是模式视图控制器本身的方法中?
【问题讨论】:
标签: ios cocoa-touch uinavigationcontroller modalviewcontroller navigationbar