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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T05:06:03+00:00 2026-05-19T05:06:03+00:00

I had the UIActivityIndicatorView working fine in simulator and other 3.0 devices in my

  • 0

I had the UIActivityIndicatorView working fine in simulator and other 3.0 devices in my app. But I found out that it was not spinning (or showing) in the new iphone 4. Basically I need to show the activity indicator when a button is clicked and hide it when the button click event is complete. I was using the approach below.

[NSThread detachNewThreadSelector: @selector(spinBegin) toTarget:self withObject:nil];

from this link. As mentioned, it correctly spins the activity indicator on all except 4.*.. not sure why. To get around this, I also followed another approach something like (from developer.apple.com)

`
(IBAction)syncOnThreadAction:(id)sender

{

[self willStartJob];



[self performSelectorInBackground:

    @selector(inThreadStartDoJob:)

    withObject:theJobToDo

];

}

(void)inThreadStartDoJob:(id)theJobToDo

{

NSAutoreleasePool * pool;

NSString *          status;



pool = [[NSAutoreleasePool alloc] init];

assert(pool != nil);



status = [... do long running job specified by theJobToDo ...]

[self performSelectorOnMainThread:

    @selector(didStopJobWithStatus:)

    withObject:status

    waitUntilDone:NO

];



[pool drain];

}

`

The problem with this was that, it is showing the acitivityVIewIndicator spinning correctly (at least on the simulator) but after it stops, the built in activity indicator in the top bar (where it shows the battery% etc) is still spinning.

I’m new to objective C. I have finished my app completely but for this silly thing. I realize there is no way to display UIActivityView without starting another thread. and finally, just to rant, I don’t understand why they have to make it so complicated. I mean they knew it was going to have this problem, why not provide a sample code everyone can use rather than deriving their own solutions.

Finally, can anyone please provide me with a direction or some sample code. I would really appreciate it. I have been searching for a few hours now and have not found anything really that works!

  • 1 1 Answer
  • 3 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-19T05:06:04+00:00Added an answer on May 19, 2026 at 5:06 am

    Why are you starting/stopping the indicator on a separate thread? Any methods you send to your UIActivityIndicatorView must be sent on the main (UI) thread.

    Any events sent by a button pressed will automatically be run on the main thread. If you’re using background threads to complete the process, you could do something like:

    - (IBAction)buttonPressed:(id)sender {
        // This runs on the main thread
        [activityIndicator startAnimating];
        [self performSelectorInBackground:@selector(inThreadStartDoJob:) withObject:theJobToDo];
    }
    
    - (void)inThreadStartDoJob:(id)theJobToDo {
        // Set up autorelease pool
        ...
        // Run your long-running action
        ...
        // Stop the spinner. Since we're in a background thread,
        // we need to push this to the UI Thread
        [activityIndicator performSelectorOnMainThread:@selector(stopAnimating) withObject:nil waitUntilDone:YES];
    }
    

    Edit: As for the activity indicator in the top bar (where the battery is), doesn’t this automatically start/stop based on network activity?

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

Sidebar

Related Questions

I had an app that worked fine in IOS4 but stopped displaying videos in
Had a page that was working fine. Only change I made was to add
Had received a module from CCAVENUE and it was working fine with Magento 1.6.2...
Had a good search here but can't see anything that gets my mind in
Had a problem with the recursive conflictCheck() method. That seems fine now. I have
Had a question about a implementation of bind function that I found on Mozilla's
Had a quick question.. Googled but nothing worthwhile found.. I have a simple type
Had this working well in Emacs 23.1.x but it appears to have broke in
Had to download Command Line Tools from Apple to get make to work, but
Had a good read through similar topics but I can't quite a) find one

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.