0
Я хочу сделать вид таблицы в быстры, и я получаю следующую ошибкуНе соответствует протоколу UITableViewDataSource
«не соответствует к UITableViewDataSource протокола»
Может ли подскажите, где я ошибаюсь?
import UIKit
class WalkthroughScreen2ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate{
let cityArray = ["Portland","San Francisco","Cupertino"]
override func viewDidLoad() {
super.viewDidLoad()
self.createReminderLabel()
// Create our UITableView with our view's frame
var tableView: UITableView = UITableView(frame: self.view.frame)
// Register our cell's class for cell reuse
tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "Cell")
// Set our source and add the tableview to the view
tableView.dataSource = self
self.view.addSubview(tableView)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int {
return cityArray.count
}
func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
// dequeue a cell for the given indexPath
var cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as UITableViewCell
// set the cell's text with the new string formatting
cell.textLabel.text = "\(cityArray[indexPath.row])"
return cell
}
}