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

https://drive.google.com/file/d/1ZrvFoYM18AbZGeRLY_42sshXXBtUAUgo/view

https://drive.google.com/file/d/1WvMzrkVw172Tou25m9nILbqffAZfSu6L/view?usp=sharing

https://drive.google.com/file/d/1vfaLfI8nKl4Bmk_1MMWYXX5fWpheMiZe/view?usp=sharing

https://drive.google.com/file/d/1m2Zq0xRoGPvO59ZXlDHvTya1cHcs0iji/view?usp=sharing

1      

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

1      

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.