Dynamic Height Issue for UITableView Cells (Swift)

前端 未结 25 2674
温柔的废话
温柔的废话 2020-11-28 04:39

Dynamic text of variable length are being injected into tableview cell labels. In order for the tableview cells\' heights to be dynamically sized, I have implemented in

25条回答
  •  广开言路
    2020-11-28 05:00

    self.Itemtableview.estimatedRowHeight = 0;
    self.Itemtableview.estimatedSectionHeaderHeight = 0;
    self.Itemtableview.estimatedSectionFooterHeight = 0;
    
    
    [ self.Itemtableview reloadData];
    self.Itemtableview.frame = CGRectMake( self.Itemtableview.frame.origin.x,  self.Itemtableview.frame.origin.y,  self.Itemtableview.frame.size.width,self.Itemtableview.contentSize.height + self.Itemtableview.contentInset.bottom + self.Itemtableview.contentInset.top);
    

提交回复
热议问题