Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6885411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:37:51+00:00 2026-05-27T05:37:51+00:00

I have some table cells displaying different time. I want the time to be

  • 0

I have some table cells displaying different time. I want the time to be updated (just like countdown).

I tried to call [my_table_name reloadData] every second but the method does not invoke logics in cellForRowAtIndexPath. How can I loop through the cells of UITableView to update its contents?

UPDATE: the time displayed is in form of 10 days 11:12:49 ( each cell has an expiry date, when the table is updated, the expiry date subtracts current time & calculate the time remaining , which is displayed on cell )

UPDATE 2: There are 2 methods to reload data. One is calling from server, one is calling the function only.

- (void)reloadLocal {
  [my_table_name reloadData];
}

and the online method is:

- (void)reloadFromServer {
  [self parseXML:@"URL here"];
}
- (void)parseXML:(NSString *)URL {
  // read the XML & update a NSArray containing the data
}

the reloadLocal method is called like this (in viewDidLoad )

current = [[NSDate date] retain];
[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(reloadLocal) userInfo:nil repeats:YES];

for the cellForRowAtIndexPath method, here is the pseudo codes (too long to post all lines):

static NSString *identifier = @"CustomCell";
CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:identifier];

NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:identifier owner:nil options:nil];
    for (id currendObj in topLevelObjects) {
        if ([currendObj isKindOfClass:[UITableViewCell class]]) {
            cell = (CustomCell *)currendObj;
            break;
        }
    }
// then insert data to related UIOutlet elements.
NSDate *validUntil = [[NSDate alloc] initWithTimeInterval:diff sinceDate:current];

NSCalendar *sysCalendar = [NSCalendar currentCalendar];
unsigned int unitFlags = NSHourCalendarUnit | NSMinuteCalendarUnit | NSDayCalendarUnit | NSSecondCalendarUnit;

NSDateComponents *conversionInfo = [sysCalendar components:unitFlags fromDate:current toDate:validUntil options:0];

cell.lbl_day.text = [NSString stringWithFormat:@"%d", [conversionInfo day]];
cell.lbl_minute.text = [NSString stringWithFormat:@"%d", [conversionInfo minute]];
cell.lbl_second.text = [NSString stringWithFormat:@"%d", [conversionInfo second]];
cell.lbl_hour.text = [NSString stringWithFormat:@"%d", [conversionInfo hour]];

note that current is an instance of current time, in data type NSDate.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:37:52+00:00Added an answer on May 27, 2026 at 5:37 am

    End up I discovered if I update the date variable current in reloadLocal, the time displaying will automatically be updated.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some table cells containing dates formatted like this: 2009-01-01. I.E 7 seems
I have have some code which adds new cells to a table and fills
I have an access table which has some cells as blank ( no data
I have a table, containing rows, contaning cells - and some of them contain
I have some code to update a database table that looks like try {
I have some custom table view cells that takes a while to draw, so
I have a tableview controller under a navigation controller. Some of my table cells
Do you know how to have some cells appear in a table view after
I'm currently writing a filter for a selectable, I have some table cells that
I have a grouped table view that utilizes two different custom table cells. When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.