候选者有不匹配的类型UITableView? [英] Candidate has non-matching type UITableView?
本文介绍了候选者有不匹配的类型UITableView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Xcode说候选者有非匹配类型UITableView .....任何人都知道如何计算出来?
Xcode says that "Candidate has non-matching type UITableView....."Anyone know how to figure this out?
func tableView(tableView: UITableView?, numberOfRowsInSection section: Int)
-> Int {
return dataSource[section].count
}
func tableView(tableView: UITableView?, cellForRowAtIndexPath indexPath: NSIndexPath!)
-> UITableViewCell? {
let cell = tableView!.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as UITableViewCell
if let path = indexPath{
let currentString = dataSource[path.section][path.row]
cell.textLabel?.text = currentString
}
return cell
}
推荐答案
函数签名已更改。您需要更新到这些:
The function signatures have changed. You need to update to these:
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
和
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
这篇关于候选者有不匹配的类型UITableView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文