Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

uaecasher

macrumors 65816
Original poster
Jan 29, 2009
1,289
0
Stillwater, OK
Hello,

I want to keep changing the position of an image on screen randomly, not sure how make this, I searched around but didn't find something useful, any help would be much appreciated.
 

MacKeeper-fan

macrumors member
Jun 30, 2010
48
0
just call arc4random() for the coordinate center of the image.

something like:

myImage.center = CGRectPoint(arc4random() % 320, arc4random() % 480);

better put in some more maths into it, so that it caters for the width/height of the image.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.