Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/sql-server-2008/3.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 无法调用';可查询…';带有类型为';(字符串)和#x27;_Ios_Uitableview_Swift_Parse Platform - Fatal编程技术网

Ios 无法调用';可查询…';带有类型为';(字符串)和#x27;

Ios 无法调用';可查询…';带有类型为';(字符串)和#x27;,ios,uitableview,swift,parse-platform,Ios,Uitableview,Swift,Parse Platform,无法使用类型为“(字符串)”的参数调用“可查询…” 在线var单元:UITableViewCell= self.tableView.dequeueReusableCellWithIdentifier(“cell”)为 UITableViewCell (对不起,我对Xcode和swift非常陌生) 当我在情节提要中单击我的UITableView时,它是一个带有样式副标题和标识符单元格的表视图单元格。(我可能完全错了,不确定)请在情节提要中定义您的单元标识符 我想我找到了问题所在,尝试使用deque

无法使用类型为“(字符串)”的参数调用“可查询…” 在线var单元:UITableViewCell= self.tableView.dequeueReusableCellWithIdentifier(“cell”)为 UITableViewCell

(对不起,我对Xcode和swift非常陌生)
当我在情节提要中单击我的UITableView时,它是一个带有样式副标题和标识符单元格的表视图单元格。(我可能完全错了,不确定)

请在情节提要中定义您的单元标识符


我想我找到了问题所在,尝试使用
dequeueReusableCellWithIdentifier
调用的
self
一词,如下所示:

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

    var cell:UITableViewCell = self.tableView.dequeueReusableCellWithIdentifier("cell") as UITableViewCell

    cell.textLabel!.text = self.funlists[indexPath.row]

    return cell
}
原因是您希望使用来自函数的tableView,而不是属于类的tableView


让我知道这是否解决了您的问题

var cell:UITableViewCell=self.tableView.dequeueReusableCellWithIdentifier(“cell”,forIndexPath:indexPath)作为UITableViewCelldefine中的单元格标识符storyboard@Memon,谢谢,我已经在情节提要中定义了单元标识符。当我将代码行更改为您提供的代码行时,会出现错误:无法使用类型为“(String,forIndexPath:NSindexPath)的参数调用“dequeReusable…”'在线上,似乎我已经这样做了,但错误仍在继续。请在swift for table view-@moez05中检查此帖子,这是因为返回了一个AnyObject,而swift不确定它是否可以转换为UITableViewCell,将!您强制转换的代价是,如果您出错,应用程序将崩溃,但是在这种情况下,您可以肯定地使用此函数,因为此函数始终返回UITableViewCell,我不确定苹果为什么在此处将AnyObejct作为返回类型。
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath:   NSIndexPath) -> UITableViewCell {

    var cell:UITableViewCell = tableView.dequeueReusableCellWithIdentifier("cell") as UITableViewCell

    cell.textLabel!.text = self.funlists[indexPath.row]

    return cell
}