У меня есть трудности в написании кода, ошибка в протоколе, я использую Xcode 7.3.1 Type'ViewController»не соответствует протоколу„UITableViewDataSource“
//2 Method dari protokol UITableViewDataSource->method 1.
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
//Return the numberofRowsInSection.
return namaRestoran.count
}
//Method 2.
func tableView(tableView: UITableView, cellForRowAtIndextPath indexPath: NSIndexPath) -> UITableViewCell {
let cellIdentifier = "Cell"
let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as UITableViewCell
//Configurasi the Cell.
cell.textLabel?.text = namaRestoran[indexPath.row]
return cell
}
Вы должны смотреть на все сообщение об ошибке; он должен сообщить вам, какие методы вы не реализовали, чтобы соответствовать этому протоколу. – Kilazur