UITableViewDataSource方法的无效重新声明? [英] Invalid redeclaration of UITableViewDataSource method?

查看:110
本文介绍了UITableViewDataSource方法的无效重新声明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实现UITableViewDataSource的必需方法,但出现一个奇怪的错误:

I'm trying to implement the required methods of UITableViewDataSource but I'm getting a weird error:


无效的' tableview(_:cellForRowAtIndexPath :)'

"invalid redeclaration of 'tableview(_:cellForRowAtIndexPath:)'"

但是我不确定是什么问题。这是相关的两行代码,即类的声明和符合协议的协议/超类:

However I'm not sure what the problem is. Here are the two relevant lines of code, the declaration of the class and conforming protocols/superclass:

class SubjectFormViewController: UIViewController,UITableViewDelegate,UITableViewDataSource

以及触发错误的函数声明:

and the function declaration that's triggering the error:

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) ->  UITableViewCell


推荐答案

该函数在您的类中有两次。搜索并删除其中之一。

You have this function twice in your class. Search for it and erase one of them.

这篇关于UITableViewDataSource方法的无效重新声明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆