我创建弹出自定义UIView。我创建了custom.xib,custom.swift。在我的custom.xib中,我的所有者对象引用了自定义。我已经在custom.swift和loadNib中实现了名为“custom”的init func。我从init func获得了无穷的呼叫,直到我在super.init(coder: aDecoder)
得到了这个警告和断点。自定义UIView的警告
警告:无法加载任何Objective-C类信息。这会使 显着降低可用类型信息的质量。
的ViewController
let customView: Custom = Custom(frame: CGRectMake(100,100,200,200))
self.view.addSubview(customView)
定制
var view: Custom!
override init(frame: CGRect) {
super.init(frame: frame)
loadNib()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
loadNib()
}
private func loadNib() -> Custom {
return NSBundle.mainBundle().loadNibNamed("Custom", owner: self, options: nil)[0] as! Custom
}