Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/20.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
自身文件中的TableviewDataSource不符合swift中的协议UITableViewDataSource_Uitableview_Swift_Protocols - Fatal编程技术网

自身文件中的TableviewDataSource不符合swift中的协议UITableViewDataSource

自身文件中的TableviewDataSource不符合swift中的协议UITableViewDataSource,uitableview,swift,protocols,Uitableview,Swift,Protocols,错误:类型MapListDataSource不符合协议UITableViewDataSource 我已经尝试过实现UITableViewDatasource所需的最少数量的函数,但编译器仍然不接受它。这不是在视图控制器中实现的,数据源被拆分为它自己的文件。为什么它不符合协议?这两种方法是最低要求,对吗?您必须添加所需的方法 func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> In

错误:类型MapListDataSource不符合协议UITableViewDataSource


我已经尝试过实现UITableViewDatasource所需的最少数量的函数,但编译器仍然不接受它。这不是在视图控制器中实现的,数据源被拆分为它自己的文件。为什么它不符合协议?这两种方法是最低要求,对吗?

您必须添加所需的方法

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

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 
      let cell:UITableViewCell=UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: "cell")
      return cell
    }

其实有那个方法但是有旧的!来自较旧的实现。谢谢
    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 1
    }

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 
      let cell:UITableViewCell=UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: "cell")
      return cell
    }