I want a random frame.origin.x
and frame.origin.y
on each button click. The button need's to move inside of the iPhone screen.
CGRect frame = MyButton.frame;
frame.origin.x = 10;
frame.origin.y = 10;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration: 0.1];
MyButton.frame = frame;
[UIView commitAnimations];
Does anyone know how i can generate a random number/position? Something like
frame.origin.x = frame.size.width * (arc4random() % (10 - 1)); ?
But this is moving the button outside the screen