【发布时间】:2015-09-01 20:05:03
【问题描述】:
我尝试为我的 UITableViewCell 类提供一个自定义初始化程序,但我无法弄清楚我做错了什么。
这是我的代码:
init(dataObject: [NSManagedObject]!, objectAttributeValues: [String]!,placeholder: String!, segmentedControl: UISegmentedControl?, cellHeight: CGRect, cellWidth: CGRect) {
self.dataObject = dataObject
self.Placeholder.text = placeholder
self.objectAttributeValues = objectAttributeValues
if segmentedControl != nil {
self.segmentedControl = segmentedControl!
didHaveSegmentedControl = true
}
}
required init(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
我试图调用 super.init(frame: CGRect(...)) 但通过实现这个我得到另一个错误:必须调用超类 'UITableViewCell' 的指定初始化程序
我能做什么? 非常感谢!
【问题讨论】:
标签: ios uitableview error-handling swift2 xcode7