0

I have a label inside a scroll view iOS.
And a timer to update the label text.
It work OK but if I'm scrolling the scroll view, the label does not update

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

- (void) countDown {
      label.text = [[NSDate date] description];
}

Answer here: My custom UI elements are not being updated while UIScrollView is scrolled

Community
  • 1
  • 1
mthuong
  • 407
  • 1
  • 5
  • 13
  • 1
    Show us the code. Also describe exactly what you expect and are seeing/not seeing. – rooftop Mar 07 '13 at 17:39
  • http://stackoverflow.com/questions/4109898/my-custom-ui-elements-are-not-being-updated-while-uiscrollview-is-scrolled Here is the answer for my question – mthuong Mar 28 '13 at 01:42

2 Answers2

0
[self performSelector:@selector(onTick:) withObject:nil afterDelay:2.0];

-(void)onTick:(NSTimer *)timer {
   label.text = //what you want.
}

Hope this helps..

lakshmen
  • 28,346
  • 66
  • 178
  • 276
0

Use this UIScrollViewDelegate method to update the label

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{
   // here update your label
}
Hari Babu
  • 891
  • 1
  • 9
  • 22