我是 xcode 编程新手,遇到了这个错误。我不确定新更新的 xcode 希望我在这里做什么,因为它在我升级之前就可以工作。
错误:
Value of type 'FormBaseCell' has no member.
我的代码:
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let rowDescriptor = formRowDescriptorAtIndexPath(indexPath)
let formBaseCellClass = formBaseCellClassFromRowDescriptor(rowDescriptor)
let reuseIdentifier = NSStringFromClass(formBaseCellClass)
var cell: FormBaseCell? = tableView.dequeueReusableCellWithIdentifier(reuseIdentifier) as? FormBaseCell
if cell == nil {
cell = formBaseCellClass.init(style: .Default, reuseIdentifier: reuseIdentifier)
cell?.tableViewController = self // <--error
cell?.configure()
}
最佳答案
我不确定您从哪里获得此代码。我从未见过有人经历所有这些步骤来获得细胞。您应该能够执行此操作:
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
// Set up your table and prototype cell on storyboard
let reuseIdentifier = "MyCell"
var cell: FormBaseCell? = tableView.dequeueReusableCellWithIdentifier(reuseIdentifier) as? FormBaseCell
if let cell = cell {
cell.textLabel.text = "something"
}
else {
cell = FormBaseCell()
}
return cell
}
关于ios - 类型 'FormBaseCell' 的值没有成员,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35993966/