2016-03-14 94 views
0

我是xcode編程新手,遇到此錯誤。我不確定新更新的xcode希望我在這裏做什麼,因爲它在我升級之前就已經工作了。'FormBaseCell'類型的值沒有成員

錯誤:

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() 
    } 

回答

0

我不知道你來自哪裏得到這個代碼。我從來沒有見過任何人通過所有這些步驟來獲得細胞。你應該能夠做到這一點:

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 
} 
相關問題