'UITableViewCell'没有名为'businessLabel'的成员

Joh*_* II 2 uitableview ios swift

我在尝试配置原型单元以与几个阵列一起使用时遇到了一个奇怪的错误.我已经设置了一个由'BDTableViewController'控制的表视图控制器,并包含一个由'BDTableViewCell'类控制的原型单元.然而,Xcode抱怨说

'UITableViewCell'没有名为'businessLabel'的成员

当businessLabel出口明确链接到我的BDTableViewCell时.包括文件本身.什么是错的?

BDTableViewController:

import UIKit

class BDTableViewController: UITableViewController, UITableViewDelegate {


var BusinessNameArray = [String]()
var BusinessLogoArray = [String]()
var BusinessAddressArray = [String]()
var BusinessNumberArray = [String]()
var BusinessWebsiteArray = [String]()

override func viewDidLoad() {
    super.viewDidLoad()

    BusinessNameArray = ["Premiere Dance"]
    BusinessLogoArray = ["PD.tiff"]
    BusinessAddressArray = ["30 Brower Lane, Hillsborough, NJ 08844"]
    BusinessNumberArray = ["(908) 281-9442"]
    BusinessWebsiteArray = ["http://premieredancenj.com/"]


    // Do any additional setup after loading the view.
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

// MARK: - Table view data source

override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
    // #warning Potentially incomplete method implementation.
    // Return the number of sections.
    return 1
}

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    // #warning Incomplete method implementation.
    // Return the number of rows in the section.
    return BusinessNameArray.count
}


override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

    var cell = tableView.dequeueReusableCellWithIdentifier("Cell") as! UITableViewCell

    let item = BusinessNameArray[indexPath.row]

    cell.businessLabel.text = item




    return cell
}
}
Run Code Online (Sandbox Code Playgroud)

BDTableViewCell:

import UIKit

[![enter image description here][1]][1]class BDTableViewCell: UITableViewCell {

@IBOutlet weak var businessLogo: UIImageView!
@IBOutlet weak var businessLabel: UILabel!
@IBOutlet weak var businessAddress: UILabel!
@IBOutlet weak var businessPhone: UILabel!
@IBOutlet weak var businessWebsite: UILabel!

override func awakeFromNib() {
    super.awakeFromNib()
    // Initialization code
}

override func setSelected(selected: Bool, animated: Bool) {
    super.setSelected(selected, animated: animated)

    // Configure the view for the selected state
}

}
Run Code Online (Sandbox Code Playgroud)

Glo*_*del 8

有了这条线

var cell = tableView.dequeueReusableCellWithIdentifier("Cell") as! UITableViewCell
Run Code Online (Sandbox Code Playgroud)

你让编译器知道那cell是(只)a UITableViewCell,但是常规UITableViewCelldons没有一个叫做的属性businessLabel.将行更改为时

var cell = tableView.dequeueReusableCellWithIdentifier("Cell") as! BDTableViewCell
Run Code Online (Sandbox Code Playgroud)

代码将编译.