gpt4 book ai didi

ios - 类型'ViewController'不符合协议(protocol) 'UITableViewDataSource'

转载 作者:行者123 更新时间:2023-11-28 21:21:15 24 4
gpt4 key购买 nike

我写代码有困难,协议(protocol)出错,我用的是xcode 7.3.1 enter image description here

//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
}

最佳答案

看起来你拼错了 tableView(tableView: UITableView, cellForRowAtIndextPath indexPath: NSIndexPath) -> UITableViewCell

应该是 tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell

关于ios - 类型'ViewController'不符合协议(protocol) 'UITableViewDataSource',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39752208/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com