WWDC22 SALE: Save 50% on all my Swift books and bundles! >>

Project 2: how to adjust custom high res image size to button? its too big(screenshots attached)

Forums > 100 Days of Swift

Hi, i used the highest resolution from https://github.com/hampusborgos/country-flags , 1000 pixels but the image is too big when i assign it to the button under Project 2. I want to create a game for all country flags and tried figuring out a couple hours how to fit image within the button but to no avail.

Anyone can help how xcode can auto-resize to fit within the button size? attached 3 screenshots below






well, i think for buttons, the .png files do not automatically resize to the button size, unlike for image View.

i had to reduce the .png imagesize down to 150 pixels in order to fit within the button sizes


Hacking with Swift is sponsored by Emerge

SPONSORED Optimize your app’s startup time, binary size, and overall performance using Emerge’s advanced app optimization and monitoring tools. Reliably measure app size, speed up your app's startup time with Emerge's Launch Booster, and much more. Emerge is actively used by many of the top mobile development teams in the world.

Find out more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.