我在更新标签时遇到了问题。它不会删除旧值,因此新值会放在旧值之上。任何对此的帮助将不胜感激。
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++;
}
}