UITableViewCell根本没有出现

时间:2015-12-06 01:21:20

标签: ios swift uitableview

我的UITableViewCell没有出现。

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return resultsProdName.count
}

func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
    return 140
}

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cell: tvcMyProducts = tableView.dequeueReusableCellWithIdentifier("tblViewCellMyProdsss", forIndexPath: indexPath) as! tvcMyProducts

    if self.resultsProdsDescArray.count > 0 && self.resultsProdName.count > 0 {
        cell.lblProdDesc.text = self.resultsProdsDescArray[indexPath.row]
        cell.lblProdName.text = self.resultsProdName[indexPath.row]
        if (self.resultsHasProdPicArray[indexPath.row] != false) {
            resultsProdPicArray[indexPath.row]?.getDataInBackgroundWithBlock({ (imgData: NSData?, error: NSError?) -> Void in
                if error == nil {
                    cell.imgViewProdPic.image = UIImage(data: imgData!)
                }
            })
        }
    }

    return cell
}

我让超级课程符合:UITableViewDataSource, UITableViewDelegate

我已经完成了我搜索过的所有内容,但它仍然没有出现。 UITableViewCell甚至还有一个我在代码中调用的唯一标识符:tblViewCellMyProdsss

课程tvcMyProductsUITableViewCell,其中包含imgViewProdPic& lblProdName等。

我错过了什么或做错了什么?

当我使用我输入的“股票数据”运行程序时,UITableViewCell甚至没有出现。它根本没有出现。

1 个答案:

答案 0 :(得分:-1)

我自己解决了这个问题。在调用我的函数之后,我必须添加的是:self.tblViewMyProds.reloadData()