将 UINavigationBar 添加到 UITabBarController
好吧,我实际上必须使用以下教程在 UITabBarController 中添加 UINavigationBar: http://twilloapp.blogspot.com/2009/03/how-to-embed-navigation-controller.html
但现在的问题是,每当我在其中一个视图中添加新按钮时它只是崩溃了。
例如:
在第一个名为 FirstViewController 的视图中,我添加了:
IBOutlet UIButton *test;
我还创建了:
- (IBAction) doSomething:(id)sender;
我将测试按钮与界面生成器中的 UI 连接起来。但当我跑步时,我得到:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x3b12e80> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key test.'
不确定这是怎么回事。
有谁知道解决方案吗?
另外,有谁知道我在哪里可以找到这些应用程序的良好预构建模板,这样我就可以开始工作而不是编辑和设置东西。
谢谢
Ok so I actually got to add UINavigationBar inside a UITabBarController using the following tutorial: http://twilloapp.blogspot.com/2009/03/how-to-embed-navigation-controller.html
But now the issue is that whenever I add a new button inside one of the views it just crashes.
For example:
In the first view called FirstViewController I added:
IBOutlet UIButton *test;
Than I also created:
- (IBAction) doSomething:(id)sender;
I hook up the test button with the UI in interface builder. But when I run i get:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x3b12e80> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key test.'
Not sure what's going on with this.
Does anyone know of a solution?
Also, does anyone know where can I find good pre-built templates for these kinda apps so I can just start working rather than editing and setting things up.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您在运行时取消归档 nib 文件时,它将在控制器上调用
setTest:aButton
,这将重定向到setValue:aButton forKey:@"test"
。由于它抛出一个异常,它不知道键@"test"
的含义,因此您很可能忘记将@synthesize test;
放入您的中FirstViewController.m 文件。
When you unarchive the nib file at runtime, it's going to invoke
setTest:aButton
on your controller, which will redirect tosetValue:aButton forKey:@"test"
. Since it's throwing an exception that it doesn't know what the key@"test"
means, chances are you forgot to put the@synthesize test;
in yourFirstViewController.m
file.