У меня возникает странная ошибка при попытке настроить ячейку прототипа для использования с несколькими массивами. Я создал контроллер табличного представления, который управляется «BDTableViewController» и содержит одну ячейку прототипа, которая управляется классом «BDTableViewCell». Однако Xcode жалуется, что«UITableViewCell» не имеет члена с именем «businessLabel»
«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
}
}
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
}
}
И убедитесь, что у вас есть «BDTableViewCell», указанный в инспекторе атрибутов ячейки прототипа. – Adrian
@AdrianB, если бы это было не так, он не смог бы подключить выходы в раскадровке. – Glorfindel