Cell layout is not updated until cell is reused.
if you want tableview to reflect the changed constraints of cells.
one solution is to reload the cells whose layout constraints have been updated using
tableview.reloadRows(at: [IndexPath], with: animation)
other solution is
tableview.beginUpdates()
tableview.setNeedsDisplay()
tableview.endUpdates()