我正在关注 this制作滑动应用的教程。
我添加了 ECSlidingViewController在我的项目中。
我只执行了教程中的几个步骤就遇到了错误。
除了教程中的代码,我没有用代码编写任何东西,即
- (void)viewDidLoad
{
[super viewDidLoad];
self.topViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"ToDoView"];
}
当我运行该应用程序时,我的应用程序崩溃并向我显示此错误:
Terminating app due to uncaught exception 'Missing topViewController',
reason: 'Set the topViewController before loading ECSlidingViewController'
我在谷歌上搜索并尝试了很多方法,其中一些来自链接:
我找不到任何真正的解决方案。
最佳答案
当我交换 ViewDidLoad 中的行时,它可以工作文件,这很奇怪:
- (void)viewDidLoad
{
self.topViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"ToDoView"];
[super viewDidLoad];
}
关于ios - 在加载ECSlidingViewController之前设置topViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29792923/