2

Why won't the UILabel: "lbl" update on the iPhone?

... from within a method:

myTimer =[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(displayDataTimer) userInfo:nil repeats:YES];

...

-(void) displayDataTimer{

    NSString *temp = [textField1 text];

    [lbl setText:[NSString stringWithFormat:@"%d  %d", j, genValue]];

    //[self.view setNeedsDisplay:YES];    

    j++;
}

thx

1
  • 1
    Note that timer fire methods should not be parameterless. They should look like: -(void)displayDataTimer:(NSTimer *)tim; Is the timer being created on the main thread? Are you certain that the fire method is being run?
    – jscs
    Jan 9, 2012 at 20:31

1 Answer 1

0

Make sure your method is firing and you have set an Outlet to that label (named lbl) and that it is wired up and then:

self.lbl.text = [NSString stringWithFormat:@"%d  %d", j, genValue];

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.