我有一个应用程序,我的 Storyboard文件中有一个 ViewController。我已经向这个 viewController 添加了一个按钮,它应该调用 Storyboard之外的另一个 ViewController,并且它有自己的 .xib 文件。但是,当我按下这个按钮时,方法正在被调用,但是新的屏幕并没有被加载,我不知道为什么。
这是我下面的相关代码:
- (IBAction)showTireCount:(id)sender {
NSLog(@"do i get called?");
SecondViewController *secondView = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
[self.navigationController pushViewController:secondView animated:YES];
}
我能够在系统输出中看到文本“do i get called”,但遗憾的是没有其他任何事情发生。谁能看出我做错了什么?
最佳答案
self.navigationController 为零。您是否将 View Controller (带有按钮的那个)嵌入到 UINavigationController 中?
关于ios - 在 iOS 中使用 Storyboard中的 .xib 文件调用 ViewController 时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19896474/