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.
Swift - Force set cell size whie UITableViewAutomaticDimension is set
If you want to continue make things your way:
remove
tableView.rowHeight = UITableViewAutomaticDimension
, because after implementingheightForRowAtIndexPath
it does nothing.implement
heightForRowAtIndexPath
method, which will return special height for chosen cells and for the others -UITableViewAutomaticDimension
Related Topics
Swift 2.1 [Uint8] --Utf8--> String
Fixing Nsurlconnection Deprecation from Swift 1.2 to 2.0
How to Display Data from Firebase Faster
Lesser Than or Greater Than in Swift Switch Statement
Programmatically Navigate to New View in Swiftui
In Swift, How to Convert a String to an Enum
Can the Height of the Uisearchbar Textfield Be Modified
Swift: Property Conforming to a Specific Class and in the Same Time to Multiple Protocols
How to Create Dictionary That Can Hold Anything in Key? or All the Possible Type It Capable to Hold
What's the Difference Between Struct Based and Class Based Singletons
Swift 2/iOS 9 - Libz.Dylib Not Found
Any Way to Iterate a Tuple in Swift
Swift Protocol Error: 'Weak' Cannot Be Applied to Non-Class Type