dimanche 1 février 2015

swift how to display solution for each card selectively?

in my app I have a Next button and a Solution button. When you press next a new card comes up (i.e. Image card1), if you press again next another card comes up in a random way. My question is how to display the solution for each card selectively (i.e. for card1 there is the sol1)


@IBAction func nextbutton(sender: AnyObject) {



//Randomize a number for the first imageview
var firstRandomNumber = arc4random_uniform(2) + 1

//Construct a string with the random number
var firstCardString:String = String(format: "card%i", firstRandomNumber)

// Set the first card image view to the asset corresponding to the randomized number
self.Image1.image = UIImage(named: firstCardString)



}



@IBAction func solutionbutton(sender: AnyObject) {


}




Aucun commentaire:

Enregistrer un commentaire