title: How to update UILabel programmatically in iOS
body: <p>I am facing a problem with updating my labels.. it doesn't remove the old values so new values go on top of old ones.. any help with this will be appreciated..</p>
  
  <pre><code>timer = [NSTimer scheduledTimerWithTimeInterval:1
                                           target:self
                                         selector:@selector(updateLabels)
                                         userInfo:nil
                                          repeats:YES];
  
  -(void) updateLabels{
      for (GraphView *graph in arr){
          // retrieve the graph values
          valLabel = [[UILabel alloc] initWithFrame:CGRectMake(i * 200, 0, 90, 100)];
          valLabel.textColor = [UIColor whiteColor];
          valLabel.backgroundColor = [UIColor clearColor];
          valLabel.text = [NSString stringWithFormat:@"Value: %f", x];
          i++;
      }        
  }
  </code></pre>