mardi 21 juin 2016

Xcode random variable doesn't work

I'm using Xcode 7.3.1 and Swift, and i'm trying to set a random number between 1 and 50 like that: variableName = random()%50

Then i have to move an ImageView in the Y axe of that random value: imageviewName.center.y = imageviewName.center.y - variableName

But it gives me the following error: "cannot convert value of type 'int' to expected argument type 'CGFloat'. So i declared the variable like that: var RandomSquirrel2 = CGFloat() but it still doesn't wok.

Can you help me?




Aucun commentaire:

Enregistrer un commentaire