设置出口和文件所有者时swift中的NSUnknownKeyException

时间:2014-10-05 15:16:41

标签: swift ios8 xcode6 nib nsunknownkeyexception

我一直试图迅速加快速度,目前来看并不是很顺利。

我尝试在笔尖上制作自定义UIview,基本上有2个标签来显示日期和月份非常简单。我设置了附加插件的xib文件,将我的文件所有者设置为自定义类。我在objective-c中所做的一样。

我用编码器设置了init,当我尝试使用UINib获取nib并设置我的UI时,我得到了这个崩溃。

由于未捕获的异常终止应用程序&#39; NSUnknownKeyException&#39;,原因:&#39; [setValue:forUndefinedKey:]:此类不是密钥值编码兼容的密钥centerDot。&#39; < / p>

这是错误的代码(github下面的项目URL)

class func instanceFromNib() -> UIView {
        return UINib(nibName: "ACDateView", bundle: nil).instantiateWithOwner(self, options: nil)[0] as UIView
    }

required init(coder aDecoder: NSCoder) { date = NSDate() frameInset = UIEdgeInsetsZero itemDistance = 0 direction = 0 self.view = ACDateView.instanceFromNib() super.init(coder: aDecoder) addSubview(view) }
required init(coder aDecoder: NSCoder) { date = NSDate() frameInset = UIEdgeInsetsZero itemDistance = 0 direction = 0 self.view = ACDateView.instanceFromNib() super.init(coder: aDecoder) addSubview(view) }

https://github.com/nissaba/TowLineDate

Also at the same time I was trying this live rendering that we can do now in xcode6 but that fails also saying that

所以我从我的阅读中猜测,我可能错误地使用框架,正如我在网上的一些例子中看到的那样,或者它只是一些东西。我尝试了框架工作,我得到了相同的消息。

0 个答案:

没有答案