将 UINavigationBar 添加到 UITabBarController

发布于 2024-09-02 21:29:54 字数 874 浏览 2 评论 0原文

好吧,我实际上必须使用以下教程在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

如若梦似彩虹 2024-09-09 21:29:54

当您在运行时取消归档 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 to setValue: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 your FirstViewController.m file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文