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