title: How can I create an event to move a button randomly?
body: <p>I have a button in a game and it is called redDot1. I have it located on my storyboard and it works great, but when the ScoreNumber is 10 or higher I want it to move around the screen to a random position and once it gets there it moves to another random position.. In Scratch, this was called glide if anybody is familiar with scratch. I uploaded a video of what I mean by showing the orange dot. <a href="http://youtu.be/i5Cy8ErqqE0" rel="nofollow noreferrer">YouTube</a></p>
  
  <p>Here is the code for my ScoreNumber where I would want to begin the movement.</p>
  
  <pre><code>-(void)Scoring{
  ScoreNumber = ScoreNumber + 1;
  _score.text = [NSString stringWithFormat:@"Score: %i", ScoreNumber];
  if (ScoreNumber &gt; 10) {
  
     //float circles;
  }
  }
  </code></pre>
  
  <p>I imagine inside that where it says float, I would call an event [self levelUp];</p>
  
  <p>How do I create an event for redDot1 to begin moving?</p>
  
  <p>I have tried <a href="https://stackoverflow.com/questions/26317108/how-to-make-a-button-move-randomly-when-pressed">this</a> to no success.</p>
  
  <p>I tried creating this event.</p>
  
  <pre><code>-(void)levelUp{
  UIButton *redDot1 = (UIButton *)redDot1;
  
  int xmin = ([redDot2 frame].size.width)/2;
  int ymin = ([redDot2 frame].size.height)/2;
  
  int x = xmin + arc4random_uniform(self.view.frame.size.width - redDot2.frame.size.width);
  int y = ymin + arc4random_uniform(self.view.frame.size.height -   redDot2.frame.size.height);
  
  
  [redDot2 setCenter:CGPointMake(x, y)];
  
  
  }
  </code></pre>
  
  <p>EDIT: To answer comments, I am using auto-layout and constraints. and when I try this code...nothing happens.</p>