I need to randomly place a UIButton around the iPhone screen when a button is pressed. I can do this successfully, but my UIButton appears cut off on the edges sometimes. So my question is, how can I set a range of coordinates for arc4random to work with? (e.g. Only from x:75 y:75 to x:345 y:405.) If it's any help, here's my IBAction:
- (IBAction) stackOverflowExampleButtonPressed
{
CGPoint position;
position.x = (arc4random() % (75)) + 345;
position.y = (arc4random() % (75)) + 405;
anExampleButton.center = position;
}
Thanks for any help!