Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 383
simonbs Avatar asked Nov 07 '12 18:11

simonbs


People also ask

What is translatesAutoresizingMaskIntoConstraints?

translatesAutoresizingMaskIntoConstraints. A Boolean value that determines whether the view's autoresizing mask is translated into Auto Layout constraints.


1 Answers

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.

like image 134
simonbs Avatar answered Oct 03 '22 06:10

simonbs