【发布时间】:2015-07-04 11:32:58
【问题描述】:
当在 swift 中对UITabelViewCell 进行子类化时,我得到一个错误,即命名的成员不存在
自定义单元格
import UIKit
class CustomRow: UITableViewCell {
@IBOutlet var namelabel: UILabel!
}
在 tableview 类中访问它
// --- Table view ---
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return data.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell:UITableViewCell = self.tableView.dequeueReusableCellWithIdentifier("CustomRow") as! CustomRow
cell.namelabel.text = person.valueForKey("engineerName") as? String <-----cant access nameLabel
return cell
}
错误:does not have a member named 'name label'
【问题讨论】:
标签: ios swift uitableview subclassing