【发布时间】:2014-01-06 15:07:23
【问题描述】:
我正在使用storyboard,其中有 5 个视图控制器。每个ViewController 只有 1 个 UIButton。我想使用用户定义的运行时属性设置按钮的背景颜色。所以我定义了一个keyPath“bgColor”并设置了相应的十六进制颜色代码“#ffaa11”。但是应用程序在加载视图之前崩溃。它给出了例外:
[<UIRoundedRectButton 0x713fdb0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key bgColor.
我不想创建自定义类。请建议我如何通过 IB 进行估值。请检查快照。
注意:实际上,我的要求是获取已在 Interface Builder 中输入的字符串值。非常类似于用户定义的运行时属性。我以 bg 颜色为例。
【问题讨论】:
标签: ios iphone objective-c xcode