I am trying to calculate the tableView's content size height which has dynamic increasing cells. For that I am writing 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//But here I am not getting the proper height
return cell
}
I checked an answer in the question for calculating tableView content size - https://stackoverflow.com/a/17939938/5395919 which reads
Note for those for whom this isn't working -- tableView:estimatedHeightForRowAtIndexPath messes with contentSize, so you might have luck just by removing your implementation of it. – weienw
So is there any means in which I can get correct content size despite dynamic cell size?