func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.arrayLength
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "cell")
return cell
}
它会打印下一个错误:“'tableView' 的前一个定义在这里”(定义与前一个值冲突)。为什么它们会相互冲突?
最佳答案
所以我们终于找到了这个问题的答案。首先是the whole code for the Problem . (JSON 的东西来自 SwiftyJson )
这里的问题是 Orkhan 忘记在类定义中使用 UITableViewDataSource 协议(protocol)并且没有将 tableView.dataSource na delegate 设置到他自己的类中。这样做之后问题就解决了。
关于uitableview - 两个 tableView 函数相互冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29487815/