TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

Guess the Flag Project - unwanted space between the flag and the border

Forums > 100 Days of Swift

Hi

I've completed the Guess the Flag project.

One thing I wasn't able to figure out is why after adding a border to my images, it is not touching the flag but has a gap around.

This is my code:

override func viewDidLoad() {
        super.viewDidLoad()

        countries += ["estonia", "france", "germany", "ireland", "italy", "monaco", "nigeria", "poland", "russia", "spain", "uk", "us"]

        button1.layer.borderWidth = 1
        button2.layer.borderWidth = 1
        button3.layer.borderWidth = 1

        button1.layer.borderColor = UIColor.lightGray.cgColor
        button2.layer.borderColor = UIColor.lightGray.cgColor
        button3.layer.borderColor = UIColor.lightGray.cgColor

        askQuestion(action: nil)

    }

You can see a capture here:

https://imgur.com/a/yL9wNBN

Thank you

3      

4      

Thank you for this. Just one more thing to add... Once you make these changes be sure to delete the Default title. "Button" will show back up and mess with your layout.

https://imgur.com/BCkcjJ4

3      

Hacking with Swift is sponsored by String Catalog.

SPONSORED Get accurate app localizations in minutes using AI. Choose your languages & receive translations for 40+ markets!

Localize My App

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.