在tableview中找不到范围中的indexpath
import UIKit
private let reuseableIdentifier = "cell"
class TableViewController: UITableViewController{
override func viewDidLoad() {
super.viewDidLoad()
tableView.register(UITableViewCell.self,forCellReuseIdentifier: reuseableIdentifier)
}
override func numberOfSections(in tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 0
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
let cell = tableView.dequeueReusableCell(withIdentifier: reuseableIdentifier, for: indexPath )
return cell
}
}
因此,这是我的代码,但在Dequereuseablecell上:IndexPath显示出错误,就像在范围中找不到Indexpath一样。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
numberOfsections
和numberOfrowsInsection
的方法中返回大于0的数字numberOfSections
andnumberOfRowsInSection
cellForRowAt indexPath
您仍然缺少一种方法:
您使用的方法应读:
documentation
tutorial
You are still missing one method:
the method you use should read:
documentation
tutorial