I'm relatively new to auto layout design, and this problem is bugging me so bad. I have a UIImageView
nested inside a Collection View Cell
. The margin of Collection view
is set appropriately. When the margins of UIImageView
are not set, the image is displayed fine, but when I set the margins, the frame suddenly gets larger. Why is this happening? I added a link to the video of my problem.
I would need to look at your code to give you an answer related to what is wrong with your code right now, it could be that the constraint is related to the wrong parent or it could be something else (related to the very collection view).
But I can give you an way to configure completely your CollectionViewCell through .xib: https://medium.com/@michaelrojas_66889/how-to-make-a-custom-collection-view-cell-in-swift-6d5783ab7c1c