UITabelView显示为空,但单击后显示数据

时间:2017-06-14 08:24:45

标签: ios uitableview swift3

我有两个tableviewcells一个用于父级,一个用于孩子我使用我的条件填充它们但它们不显示数据而仅显示空白标签。但是当我点击一个单元格时,它会显示数据但不正确。

public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
    {
        let parentCell = tableView.dequeueReusableCell(withIdentifier: "DaleelDetailChildsTableViewCell", for: indexPath) as! DaleelDetailChildsTableViewCell

        let siblingCell = tableView.dequeueReusableCell(withIdentifier: "DaleelDetailSiblingTableViewCell", for: indexPath) as! DaleelDetailSiblingTableViewCell


//        
//        if (self.detailPerson?.childrens.count)! < 1 {
//            self.isSiblingButton = true
//          self.btnSiblings.setImage(UIImage(named:"FamilyLeftPressed"), for: .normal)
//        }

        if self.isSiblingButton{
            if indexPath.row == 0
            {
                parentCell.configuration(name: (self.detailPerson?.fatherName)!, profilePicture: "", myCell: false)
                return parentCell

            }else{

                if self.detailPerson?.name == (self.detailPerson?.siblings[indexPath.row-1].name)!
                {
                    siblingCell.configuration(person: (self.detailPerson?.siblings)!, tag: indexPath.row - 1, myCell: true )
                }else{
                    siblingCell.configuration(person: (self.detailPerson?.siblings)!, tag: indexPath.row - 1, myCell: false )
                }   
                return siblingCell
            }


        }else{

            if indexPath.row == 0
            {
                parentCell.configuration(name: (self.detailPerson?.name)!, profilePicture: (self.detailPerson?.profilePictureSquare)!, myCell: true)
                return parentCell
            }else{

                siblingCell.configuration(person: (self.detailPerson?.childrens)!, tag: indexPath.row - 1, myCell: false )

                return siblingCell
            }


        }


    }

`

0 个答案:

没有答案