0

I have a simple UITableView containing a few rows. Every row contain a countdown timer represented by UITextLabel. When row is selected, countdown starts. Countdown fire date is set by localNotification. Time to fire date is displayed in UITextLabel.

Refreshing table starts in viewWillApper method with the line below:

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

refreshTable method contain one line:

[tableView reloadData]

Everything is working as expected, but when I start to scroll the tableView (without releasing the finger) countdown timer is not updated.

I've set up a log inside refreshTable method to see whether this method is called when I scroll the table. The result was negative. Somehow refreshTable method is not called when I scroll tableView.

Can anybody tell me how to fix this issue?

I've checked default Clock App (by apple). In the first tab (world clock) is represented by table view. Inside every row there is a clock with red hand. While scrolling the table the hand is updating which means that updating table view while scrolling is possible...somehow

Thanks in advance

Darth Hunterix
  • 1,484
  • 5
  • 27
  • 31
Ivan
  • 371
  • 1
  • 3
  • 8

1 Answers1

1

You see, the UITableView class has a UIScrollView inside it. You can use UIScrollViewDelegate to force reload the page. Here's the doc: link. Look at – scrollViewDidScroll:

Iterate over the Table's subviews until you find the Scroll. If you post some code perhaps I could help more

luksfarris
  • 1,313
  • 19
  • 38
  • scrollViewDidScroll is called only when I scroll the table. When I stop scrolling (but without releasing scrolling) this method is not called and countdown timers are not updating. – Ivan Sep 22 '12 at 11:35
  • Ok, i found a solution: `[[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];` – Ivan Sep 23 '12 at 11:23
  • Lvan can you send the fully code with NSTimer Object. – Vikas Rajput Oct 15 '17 at 05:57