Reputation: 387
I'm having a hard time trying to resize a collection view header to fit on all phone screens. I am using storyboard.
I tried adding an image into the header, however I can't seem to get it to fill in different devices. If I switch to a larger iPhone screen size then image is too small, if expand the image to fit on a larger screen but then go back to a smaller screen then the image is to large and goes out of the view.
I've tired setting constraints of 0 on all edges of the header view and still no luck. At this point I'm not even sure if its even possible to resize a collection header using storyboards. Can someone point me in the right direction? I only run into issues with auto layout via storyboards when it comes to collection view cells.
Iphone 8 screen size, the header fits perfectly
Upvotes: 1
Views: 111
Reputation: 634
Please add imageView to your header view, pin it to its edges add image to it and in the attributes inspector set imageView content mode to Aspect fill. It works for me.
Upvotes: 2