I'm using a launch screen xib and I can't get the image within the UIImageView
to appear. Currently, I have a UILabel
with the imageView placed right below the label and also centered horizontally. I set all the constraints for the imageView but for some reason the label appears but the image doesn't. This is my first time using the whole wAny hAny size classes. Is there something I'm missing?
This is happening because of the horizontal space constraints of the imageView
, both the leading and trailing space to the superview
. Here the launch screen is laid out in the wAny|hAny
size class. It could not satisfy the Horizontal space -(196)
on a smaller device. So what you can do
- Remove the horizontal space constrains(both leading&trailing) of imageView
- Add
width
constraint to theimageView
orAspect Ratio
could be more appropriate - Other constraints looks fine, top & bottom spacing and centre horizontally in container keep as it is
Based on my recent experience, it appears that as of iOS 8.3, any images in the launch screen XIB have to be in the image assets. I do not know if this is the OP's problem or not, but definitely worth mentioning for other folks coming here with the same issue.
This is happening because of the horizontal space constraints of the imageView
, both the leading and trailing space to the superview
. Here the launch screen is laid out in the wAny|hAny
size class. It could not satisfy the Horizontal space -(196)
on a smaller device. So what you can do
- Remove the horizontal space constrains(both leading&trailing) of imageView
- Add
width
constraint to theimageView
orAspect Ratio
could be more appropriate - Other constraints looks fine, top & bottom spacing and centre horizontally in container keep as it is
© 2022 - 2024 — McMap. All rights reserved.
UIImageView
setting to "aspect fit". – Ethnic