【问题标题】:Adding UINavigationBar to a UITabBarController将 UINavigationBar 添加到 UITabBarController
【发布时间】:2010-05-20 21:08:59
【问题描述】:

好的,所以我实际上必须使用以下教程在 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.'

不知道这是怎么回事。

有人知道解决办法吗?

另外,有谁知道我在哪里可以为这些应用程序找到好的预构建模板,这样我就可以开始工作,而不是编辑和设置。

谢谢

【问题讨论】:

    标签: iphone xcode uinavigationcontroller uitabbarcontroller


    【解决方案1】:

    当您在运行时解压缩 nib 文件时,它将在您的控制器上调用 setTest:aButton,该控制器将重定向到 setValue:aButton forKey:@"test"。由于它抛出了一个不知道密钥 @"test" 是什么意思的异常,因此您很可能忘记将 @synthesize test; 放入您的 FirstViewController.m 文件中。

    【讨论】:

      猜你喜欢
      • 2020-12-05
      • 1970-01-01
      • 2011-05-04
      • 2018-07-26
      • 1970-01-01
      • 1970-01-01
      • 2011-09-01
      • 2015-11-26
      • 1970-01-01
      相关资源
      最近更新 更多