私はswiftでスピードを上げようとしていましたが、今のところうまくいきません。
基本的に日付と月を表示する 2 つのラベルを持つ nib でカスタム UIview を作成しようとしました。アウトレットに添付されたxibファイルをセットアップし、ファイルの所有者をカスタムクラスに設定しました。Objective-Cでも同じです。
コーダーで初期化をセットアップし、UINib を使用して nib を取得して UI をセットアップしようとすると、このクラッシュが発生します。
キャッチされない例外 'NSUnknownKeyException' が原因でアプリを終了しています。理由: '[ setValue:forUndefinedKey:]: このクラスは、キー centerDot のキー値コーディングに準拠していません。
これは問題のあるコードです (プロジェクト URL は以下の github にあります)
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)
}
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
file:///.../Base.lproj/Main.storyboard: error: IB Designables: Failed to update auto layout status: dlopen(ACDateView.framework, 1): no suitable image found. Did find:
ACDateView.framework: mach-o, but wrong architecture
したがって、ネット上のいくつかの例で見たように、フレームワークを使用するのが間違っている可能性があること、または単に何かを読んでいることを推測しています。フレームワークを使用せずに試してみましたが、同じメッセージが表示されました。