UITableViewAutomaticDimension not working until scroll UITableViewAutomaticDimension not working until scroll ios ios

UITableViewAutomaticDimension not working until scroll


Just call "reloadSections" after your Table is loaded:

self.tableView.reloadSections(NSIndexSet(indexesInRange: NSMakeRange(0, self.tableView.numberOfSections())), withRowAnimation: .None)

Or in Swift 3:

let range = Range(uncheckedBounds: (lower: 0, upper: self.tableView.numberOfSections))self.tableView.reloadSections(IndexSet(integersIn: range), with: .none)


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


I think the answers over here have fewer side effects. Specifically adding cell.layoutIfNeeded() in tableView:cellForRowAtIndexPath:

I'm also doing what @nosov suggests as is good practice, but haven't tested if they need to be done in tandem.