Uitableviewautomaticdimension Not Working for Resizing Cell Height

UITableViewAutomaticDimension not working on iOS 8

add following code in "cellForRowAtIndexPath" method before return cell.

    cell.setNeedsUpdateConstraints()
cell.updateConstraintsIfNeeded()

why UITableViewAutomaticDimension not working?

In order to make UITableViewAutomaticDimension work you have to set all left, right, bottom, and top constraints relative to cell container view. In your case you will need to add the missing bottom space to superview constraint for label under the title

UITableViewAutomaticDimension not working for UIImageView

Try to create an assistant hidden view, which set its top、bottom constraint to the contentView of cell, any width and x position, and then set its height Greater Than or Equal to 80.

UITableViewAutomaticDimension not working until scroll

I ran into the same issue and found out that the accessory cell.accessoryType messes with this automatic resizing when it is not None, so it seems like a bug in Xcode at the moment.

But as @Blankarsch mentioned, calling reloadSections(..) helps to fix this issue if you need to have an accessory.

Accessory to "None" solved my issue

Swift - Force set cell size whie UITableViewAutomaticDimension is set

If you want to continue make things your way:

  1. remove tableView.rowHeight = UITableViewAutomaticDimension, because after implementing heightForRowAtIndexPath it does nothing.

  2. implement heightForRowAtIndexPath method, which will return special height for chosen cells and for the others - UITableViewAutomaticDimension



Related Topics



Leave a reply



Submit