How do I get the contents of a custom UITableViewCell to shift and resize using Auto Layout?
To make the issue more clear, I've assigned the contentView
of my custom cell to have a light gray background color. To reduce this to the smallest problem possible, my custom cell has only one UIImageView
named ratingImageView
that shows some number of yellow stars; three such cells can be seen in the image below.
My ratingImageView
has only 4 constraints; (1) width =81, (2) height =40, (3) align center Y to superview, and (4) trailing space to superview =20. I would have expected the trailing space to superview constraint to force the image view to the left when the standard delete button appears on swipe to delete. It does not, however, as can be seen in the image below.
I've tried many different combinations of constraints and cannot make the ratingImageView
shift as I would expect.
I encountered this problem by working through a good introductory Storyboard tutorial. I had no problem making this work using good old struts and springs, but I decided to try it with Auto Layout and have had no luck.