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

Project 2 issue

Forums > 100 Days of Swift

i have this code in my xcode wheni run its showing white blanck screen not flags at all, if i remove askQuestion() call func all flags will appreat on simulator.... could any one help me please..

import UIKit

class ViewController: UIViewController {

@IBOutlet var button1: UIButton!

@IBOutlet var button2: UIButton!

@IBOutlet var button3: UIButton!
var countries = [String]()
var score = 0

override func viewDidLoad() {
    super.viewDidLoad()

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

    askQuestion() // this point has issue i have tried run command everycode i have written to find this issue...
}

func askQuestion() { button1.setImage(UIImage(named: countries[0]), for: .normal) button2.setImage(UIImage(named: countries[1]), for: .normal) button3.setImage(UIImage(named: countries[2]), for: .normal) }

}

3      

SOLVED!!!

flag name on the image is capital letter not small letters see code below.

countries += ["Estonia", "Frane", "Germany", "Ireland", "Italy", "Monaco", "Nigeria", "Poland","Russia", "Spain", "US", "UK"]

3      

Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.

Click to save your free spot now

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.