I am trying to calculate the height of the content size of a tableView with dynamically growing cells. For this, I write code as -
override func viewDidLoad() { super.viewDidLoad() self.tableView.estimatedRowHeight = 150 self.tableView.rowHeight = UITableViewAutomaticDimension } func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCellWithIdentifier("cell1", forIndexPath: indexPath) as! MostLikedTVCscnd cell.image.image = imageArr[indexPath.row] as? UIImage cell.aboutLbl.text = labelArr[indexPath.row] as? String let contentSizeHeight = tableView.contentSize.height
I checked the answer in the question for calculating the size of the contents of a View table - stack overflow site/questions/150932 / ... that reads
Note for those for whom this does not work - tableView: measuredHeightForRowAtIndexPath messes with contentSize, so you might be lucky just by deleting its implementation. - weienw
So are there any means in which I can get the right size of the content, despite the dynamic size of the cell?
source share