Hem*_*ang 0 uitableview ios swift
我遵循本指南来实施UITableView协议.但是现在,它给我一个错误,我做错了什么?
'RequestsViewController'不符合协议'UITableViewDataSource'.
class RequestsViewController: UIViewController {
...
...
}
extension RequestsViewController: UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return arrayRequests.count
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 100
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> RequestsTableViewCell {
let cell:RequestsTableViewCell = (tableView.dequeueReusableCell(withIdentifier: cellIdentifier) as! RequestsTableViewCell)
//Doing some assignments.
return cell
}
}
extension RequestsViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
}
}
Run Code Online (Sandbox Code Playgroud)
改变这一点
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> RequestsTableViewCell
Run Code Online (Sandbox Code Playgroud)
至:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
65 次 |
| 最近记录: |