UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

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

3      

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

3      

BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.

Get it on Hacking with Swift+

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

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

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.