Ios 自定义UITableViewCell没有名为error Swift的成员

Ios 自定义UITableViewCell没有名为error Swift的成员,ios,swift,uitableview,subclassing,Ios,Swift,Uitableview,Subclassing,在swift中将UITabelViewCell子类化时,im收到一个名为的成员不存在的错误 自定义单元格 import UIKit class CustomRow: UITableViewCell { @IBOutlet var namelabel: UILabel! } 在tableview类中访问它 // --- Table view --- func tableView(tableView: UITableView, numberOfRowsInSection

在swift中将
UITabelViewCell
子类化时,im收到一个名为的成员不存在的错误

自定义单元格

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
    }
/---表视图---
func tableView(tableView:UITableView,numberofrowsinssection:Int)->Int{
返回数据.count
}
func tableView(tableView:UITableView,cellForRowAtIndexPath:nsindepath)->UITableView单元格{
变量单元格:UITableViewCell=self.tableView.dequeueReusableCellWithIdentifier(“CustomRow”)作为!CustomRow
cell.namelab.text=person.valueForKey(“engineerName”)作为?字符串您忘记了一件事

var cell:CustomRow = self.tableView.dequeueReusableCellWithIdentifier("CustomRow") as! CustomRow
因为
CustomRow
应该有
namelab

或者直接使用它

var cell = self.tableView.dequeueReusableCellWithIdentifier("CustomRow") as! CustomRow

这两种方法都能奏效。

Legend!谢谢你的支持,我投了更高的票,要等12分钟才能接受——你的回答真是太快了