title: iOS - Execute a Piece of Code for 10 Seconds
body: <p>I'd like to execute a piece of code every 500ms for a total of 10 seconds. I have the code working executing every half a second with this code</p>
  
  <pre><code>[NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(getLevel:) userInfo:nil repeats: YES];
  </code></pre>
  
  <p>but I cannot seem to figure out how to stop it executing after 10 seconds. The "repeats" argument doesnt seem to allow for a specified time. 
  Could someone point me in the direction of where I should go with this?</p>
  
  <p>Thanks
  Brian</p>