Iphone SDK, arc4random CGPointmake?
Posted
by Harry
on Stack Overflow
See other posts from Stack Overflow
or by Harry
Published on 2010-04-10T09:11:11Z
Indexed on
2010/04/10
9:23 UTC
Read the original article
Hit count: 571
I have tried using integers to store the number like so:
playPin = 35 + arc4random() % 118;
playY = -50 - arc4random() %100;
if (CGRectIntersectsRect(pin.frame, refreshpin.frame)){
pin.center = CGPointMake(playPin, playY);
pinend.center = CGPointMake(pin.center.x, pin.center.y+58);
}
Then using them, when needed, but... its random the first time, then it just keeps repeating itself.
then i tried this:
if (CGRectIntersectsRect(pin.frame, refreshpin.frame)){
pin.center = CGPointMake(35 + arc4random() % 118, -50 - arc4random() %100);
pinend.center = CGPointMake(pin.center.x, pin.center.y+58);
}
And this also doesn't work, you cant even see the items i want to display!
Any ideas?
Thanks. Harry.
© Stack Overflow or respective owner