我不知道如何解决这个问题。它不断与dequeneResuableCell引发错误。我已经尝试了所有可用变量。我有xcode6。我删除了插座,因为它们不是问题,并且我没有包括HospitalList类的构造函数/初始化。
这是代码
import UIKit
class HospitalList: UIViewController {
@IBOutlet weak var hospitals: UITableView!
var Hos: [Hospital] = []
override func viewDidLoad() {
super.viewDidLoad()
Hos = createArray()
hospitals.delegate = self
hospitals.dataSource = self
}
func createArray() -> [Hospital] {
\\more code to create an array of Information
return tempHospitals
}
}
extension HospitalList: UITableViewDelegate, UITableViewDataSource {
//counts number of elements in Table View
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return Hos.count
}
//sets up whats in the table view
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let Hop = Hos[indexPath.row]
// this line is the problem right here
let cell = tableView.dequeueReusableCell(withIdentifier: "InfoHospitals")
cell.HName.text = Hop.name \\and more, but not including
return cell
}
return UITableViewCell
}