mardi 26 juillet 2016

String is equal to an If statement value and yet doesn't work, need help ASAP

I have problem with the following code:

            if finalName == "London, GB" {

        let londonImage = UIImage(named: "united-kingdom-1043062.jpg")

        imageViewPage1.image = londonImage

    }

    if finalName == "Novaya Gollandiya, RU" {

        let StPetersbourgImage = UIImage(named: "architecture-995613_1920.jpg")

        imageViewPage1.image = StPetersbourgImage

    }

    if finalName == "Berlin, DE" {

        let BerlinImage = UIImage(named: "siegessaule-200714_1920.jpg")

        imageViewPage1.image = BerlinImage

    }

    if finalName == "Tel Aviv, IL" {

        let TelAvivImage = UIImage(named: "buildings-89111.jpg")

        imageViewPage1.image = TelAvivImage

    }

    else {

        let elseImage = UIImage(named: "sun-203792.jpg")

        imageViewPage1.image = elseImage

    }

}

I already debugged and the value is "Berlin, DE" and it still does the else instead of the finalName == "Berlin, DE", can anyone help me?

Aucun commentaire:

Enregistrer un commentaire