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 7693683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:08:47+00:00 2026-05-31T21:08:47+00:00

I have some code as shown below: – (IBAction)startButtonPressed:(id)sender { statusText.text = @Processing…; //here

  • 0

I have some code as shown below:

- (IBAction)startButtonPressed:(id)sender {
    statusText.text = @"Processing...";

    //here I do a bunch of calculations

    //display calculated data
    statusText.text = [[NSString alloc] initWithFormat:@"coefficient: %.4f",
         [[coefficientEstimatesR objectAtIndex:0] doubleValue]];
}

The calculations that I do take about 17s, so I’d like to display the word “processing” while this is being done. However, when I run this, “processing” is never displayed, only the calculated data is displayed.

Any ideas on how to do this would be appreciated.
Thanks!

  • 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-31T21:08:48+00:00Added an answer on May 31, 2026 at 9:08 pm

    Do not do any processing in the GUI thread, not when it takes one second, and especially not when it takes 17 seconds. Using GCD makes offloading the task trivial:

    - (IBAction)startButtonPressed:(id)sender {
        statusText.text = @"Processing...";
    
        dispatch_async(dispatch_get_global_queue(0, 0), ^{
            //here I do a bunch of calculations
    
            dispatch_async(dispatch_get_main_queue(), ^{
                //display calculated data
                statusText.text = [[NSString alloc] initWithFormat:@"coefficient: %.4f",
                                   [[coefficientEstimatesR objectAtIndex:0] doubleValue]];
            });
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some JSF code that currently works (as shown below), and I need
I have some code where I'm returning an array of objects. Here's a simplified
Simple problem: With the XML layout shown below, I have some views wrapped in
I have some javascript as shown below for (var titleKey in data.d) { var
I have the following code to perform validation of SubmitForm shown below on click
I have written the code shown below. my problem is that I can't touch
Hi people I have the following code (shown below) and I am trying to
I have the following code shown below to allow the admin to add a
I have some html which displays data from my database. Shown below is a
I have some code for starting a thread on the .NET CF 2.0: ThreadStart

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.