simonbs
simonbs

Reputation: 8042

Resize subviews in table view when editing using auto layout

I have a table view with prototype cells. Currently I have only added a label to the cell. When enabling edit mode, a delete button will appear animating the cell smaller but the label doesn't reposition. This used to be no problem with autoresizing masks but now I can't seem to get it to work.

Does anyone know how I should configure auto layout to have the label positioned inside the cell when in edit mode?

enter image description here

Upvotes: 5

Views: 2936

Answers (1)

simonbs
simonbs

Reputation: 8042

I searched some more and found that it is necessary to remove the horizontal spacing constraint that Interface Builder adds, as this is relative to the UITableViewCell and not the contentView and then add a constraint which is relative to the content view.

You can read more about this in this answer to a similar issue.

Upvotes: 5

Related Questions