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

  • SEARCH
  • Home
  • 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 8841461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:43:26+00:00 2026-06-14T10:43:26+00:00

During the call to tableView:cellForRowAtIndexPath: I’m calling this function to format a date into

  • 0

During the call to tableView:cellForRowAtIndexPath: I’m calling this function to format a date into a time:

- (NSString *)_formatDate:(NSDate *)date withString:(NSString *)string {
    NSLocale *locale = [NSLocale currentLocale];
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    NSString *dateFormat = [NSDateFormatter dateFormatFromTemplate:string options:0 locale:locale];
    [formatter setDateFormat:dateFormat];
    [formatter setLocale:locale];
    return [formatter stringFromDate:date];
}

I’m passing in the date for the row as well as the string @"HH:mm".

Unfortunately this seems to be lagging my table view. A similar thing is happening in my section headers where I am formatting to a full date.

Is there any reason this should be lagging my app so much? Are any of these calls particularly intensive?

Thanks

Tom

  • 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-06-14T10:43:27+00:00Added an answer on June 14, 2026 at 10:43 am

    There is word that creating date formatters is expensive. Use an instance variable and set up a single date formatter in viewDidLoad, then reuse that same formatter each time you need one. Or lazy load one as needed.

    If it’s not the creation that’s expensive, but the parsing of the date string, pre-save a parsed copy of your date and use that instead. You’ll have to worry about things like location and locale changes with that though, so it gets more complicated.

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

Sidebar

Related Questions

How is the decision taken internally (during runtime) as to which function to call,
There is a Silverlight (4.0) application that is calling to WCF-service. During 1st call
During a call to function B() from function A(), B() allocates a 100-char array
What is the semantics of Bcast when number of processes during this call is
If the user received a call during application running, how to automatically open the
I'm developing an app that checks several conditions during an incoming phone call. The
During the work on my iPhone application the icon changed from time to time.
In -tableView:heightForRowAtIndexPath: I'm changing the height for a cell dynamically during usage of the
I am writing an app that is meant to be run during a call.
Is it possible to do some visible actions during telephone call? It could be

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.