0

Hi i am trying to implement Expandable UITableview which expands a cell and has a tableview inside.

when I reload the inner tableview with default from outer table view, after setting the contents, only partial part of the inner tableview is visible, I tried hardcoding the height for row and but not working.

please advice

func reloadexpandtableview (tablearray: AnyObject, indexpath : IndexPath , controller : UIViewController,tag: Int)  {
    if tag == 1 {

        self.additivesArray = tablearray as! List<Items>
        self.isAdditives = true
       // here height constraint constant works.. but the height is same even after loading the cells with data..
        self.tablview_height.constant = CGFloat(additivesArray.count * 44);
        self.indexpath = indexpath;
        self.tableview.reloadData()
    }
}
// MARK: - tableview delegates
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int{            
     return self.additivesArray.count
}


func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

    var cell : UITableViewCell!
    cell = UITableViewCell(style: UITableViewCellStyle.subtitle, reuseIdentifier: "cell")
    cell.selectionStyle = .none;
    let additives = self.additivesArray[indexPath.row]
    cell.textLabel?.numberOfLines = 0
    cell.textLabel?.lineBreakMode = .byWordWrapping
    cell.textLabel?.text = additives.desc
    cell.detailTextLabel?.text = additives.ingredient

    return cell;
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
    return UITableViewAutomaticDimension
}

In the image "other" cell has 3 inner cells but only first half of the first cell is visible

in the image "other" cell has 3 inner cells but only first half of the first cell is visible
Mohanraj
  • 587
  • 4
  • 21

0 Answers0