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 Superwall.

SPONSORED Superwall lets you build & test paywalls without shipping updates. Run experiments, offer sales, segment users, update locked features and more at the click of button. Best part? It's FREE for up to 250 conversions / mo and the Superwall team builds out 100% custom paywalls – free of charge.

Learn 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.