0
我有一个数组,它保存用户回复帖子的评论,他们保存在Parse.com中,但似乎当我尝试在tableView中显示它们时,它们不是出现。这是我用来在tableView中显示注释的内容。UITableView不显示标签,也没有单元格
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell = tableView.dequeueReusableCellWithIdentifier("commentCell", forIndexPath: indexPath) as! CommentTableViewCell
cell.commentLabel?.text = comments![indexPath.row] as String
return cell
}
我已经尝试了一些其他的代码变化和一些其他帖子在这里试图找到答案,但仍然没有运气。 我可以确认数据保存在Parse中,但似乎没有显示在应用程序中。我究竟做错了什么?
我试图添加它,它给了我以下错误:**使用未声明的类型'UITableViewDatasource'**我必须在使用dataSource之前导入其他内容吗? –
http://stackoverflow.com/questions/28017622/why-the-use-of-undeclared-type-uitableview-happened-in-swift。可能导入UIKit解决这个问题就像这个问题。 – merge
DataSource的's'是小写字母,在我将它改为大写字母后,它解决了这个问题。现在它工作正常。它还显示评论。我一直试图弄清楚这一点。你拯救了一天!谢谢! –