Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/105.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 候选人是否具有不匹配的UITableView类型?_Ios_Cocoa Touch_Uitableview_Swift - Fatal编程技术网

Ios 候选人是否具有不匹配的UITableView类型?

Ios 候选人是否具有不匹配的UITableView类型?,ios,cocoa-touch,uitableview,swift,Ios,Cocoa Touch,Uitableview,Swift,Xcode说“候选者具有不匹配的UITableView类型…”有人知道如何解决这个问题吗 func tableView(tableView: UITableView?, numberOfRowsInSection section: Int) -> Int { return dataSource[section].count } func tableView(tableView: UITableView?, cellForRowAtIndexPath ind

Xcode说“候选者具有不匹配的UITableView类型…”有人知道如何解决这个问题吗

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
    }

函数签名已更改。您需要更新以下内容:

func tableView(tableView: UITableView, numberOfRowsInSection section: Int)  -> Int {


欢迎使用Stackoverflow。对该场景稍作解释可能有助于专家理解该问题。谢谢!第一个现在可以工作了,但是在我删除“!”之后,“if let path=indexPath”上会出现一个错误,并说“条件绑定中的绑定值必须是可选类型”。我该怎么办?因为indexPath不再是可选的,所以不需要
if
条件。试着把它去掉。现在效果很好。谢谢。
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {