Skip to content

Instantly share code, notes, and snippets.

@jasonmcdermott
Created July 3, 2014 04:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonmcdermott/e9825618d5c2043cc421 to your computer and use it in GitHub Desktop.
Save jasonmcdermott/e9825618d5c2043cc421 to your computer and use it in GitHub Desktop.
- (CGRect)makeFrameForButton:(UIButton*)button
{
int randomHeightInt = roundf(self.view.frame.size.height - self.hitMeButton.frame.size.height)-50;
int randomWidthInt = roundf(self.view.frame.size.width - self.hitMeButton.frame.size.width) - 20;
int randomHeight = arc4random() %randomHeightInt + 50;
int randomWidth = arc4random() % randomWidthInt + 20;
CGRect frame = CGRectMake(randomWidth,
randomHeight,
button.frame.size.width,
button.frame.size.height );
return frame;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment