首页 > 解决方案 > How to change height of UITableViewCell when constraint changes?

问题描述

My question is related to this one: How to change height Constraint of UIView in UitableviewCell when using UITableViewAutomaticDimension

The solution there does not seem to be working for me.

enter image description here

In the image above i have a simple cell. On tap of cell, i want to change the constraint of the redView to be larger. This should then automatically change the height of the cell.

I already have the height constraint of the cell set to an @IBOutlet and i think i am correctly changing the size of the cell, but it is not working.

Here is my sample app that is not working. Any help? SampleApp - for Xcode 9.3

标签: iosswiftuitableview

解决方案


Calling the below will recalculate the heights.

[tableView beginUpdates];
[tableView endUpdates];

推荐阅读