【发布时间】:2011-08-25 23:36:43
【问题描述】:
在我的 MainWindow.xib 中,我有以下结构:
-Files Owner
-First Responder
-MyApp App Delegate
-Window
-Tab Bar Controller
--Tab Bar
--Selected Recipes Nav Controller (recipes) - The class is set to a subclass of UINavigationController
--Other tabs…
我有用于编辑的详细信息视图,其中包含每个可编辑部分的选项卡,因此结构如下所示:
-Files Owner
-First Responder
-Tab Bar Controller
--Tab Bar
--Selected View Controller (recipes) - The class is set to a subclass of UINavigationController
---Scroll View
----UITextField (txtName)
----UITextField (txtDescription)
--Other tabs…
当用户单击主导航控制器上的添加工具栏按钮时,我想将此新视图推送到堆栈上,但出现异常:
* 由于未捕获的异常“NSUnknownKeyException”而终止应用程序, 原因:'[setValue:forUndefinedKey:]: 这个类不是关键值 txtName 键的编码兼容。'
我相信这可能是由于有两个标签控制器造成的。我尝试了以下方法来显示新的详细信息视图,但都抛出了相同的异常:
MyAppAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
//[delegate.recipesNavController pushViewController:recipeDetailViewController animated:YES]; //- fails
//[delegate.rootController presentModalViewController:recipeDetailViewController animated:YES]; //- fails
[self presentModalViewController:recipeDetailViewController animated:YES]; //- also fails
编辑:我现在不太确定,因为用 UISegmentedControl 替换它会导致类似的错误:
这个类不是键值 密钥的编码兼容 generalScroller。'
【问题讨论】:
标签: iphone cocoa-touch ios interface-builder uitabbarcontroller