Это мой кодтипа TypeViewOne не соответствует протоколу UITableViewDataSource
class TableViewOne: UITableViewDataSource, UITableViewDelegate {
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("firstCell") as! firstCell
let index = indexPath.row
cell.labelMy.text = ViewController.firstData![index]
return cell
}
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if let s = ViewController.firstData {
return s.count
}
return 0
}
}
Я не знаю, почему на этот раз я получаю эту ошибку, хотя, когда я использую подкласс UITableViewController
тех, будет достаточно, звучит как UITableViewControlelr
реализован для других необходимых функций, но я не мог знать их сам.
Это похоже синтаксис «старый-быстрому». Каков ваш класс «TableViewOne», не может ли он быть «UITableViewController»? Если это так, замените заголовок класса 'class TableViewOne: UITableViewController {...'. – dfri
Принимая удар в темноте здесь, но будет ли он работать, если TableViewOne расширяет UIView? например 'class TableViewOne: UIView, UITableViewDataSource, UITableViewDelegate' –