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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:11:04+00:00 2026-05-24T03:11:04+00:00

when i click on button which title is click here to enlarge then i

  • 0

My first view is looks like  this
when i click on button which title is click here to enlarge then i want show activity indicator on the first view and remove when load this view.
second view in which image is upload from URL in image view.

but i go back then it show activity indicator which is shown in this view.
first view with activity indicator

in first vie .m file i have use this code for action.

-(IBAction)btnSelected:(id)sender{
UIButton *button = (UIButton *)sender;
int whichButton = button.tag;
NSLog(@"Current TAG: %i", whichButton);
UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
[spinner setCenter:CGPointMake(160,124)]; 
[self.view addSubview:spinner]; 
[spinner startAnimating];

if(whichButton==1)
{
    [spinner stopAnimating];

    first=[[FirstImage alloc]init];
    [self.navigationController pushViewController:first animated:YES];
    [spinner hidesWhenStopped ];

        }} 

in above code i have button action in which i call next view. Now i want show/display activity indicator when view upload. In next view i have a image view in which a image i upload i have declare an activity indicator which also not working. How do that?

  • 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-24T03:11:05+00:00Added an answer on May 24, 2026 at 3:11 am

    Toro’s suggestion offers a great explanation and solution, but I just wanted to offer up another way of achieving this, as this is how I do it.

    As Toro said,

    - (void) someFunction
    {
        [activityIndicator startAnimation];
    
        // do computations ....
    
        [activityIndicator stopAnimation];  
    }
    

    The above code will not work because you do not give the UI time to update when you include the activityIndicator in your currently running function. So what I and many others do is break it up into a separate thread like so:

    - (void) yourMainFunction {
        activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    
        [NSThread detachNewThreadSelector:@selector(threadStartAnimating) toTarget:self withObject:nil];
    
        //Your computations
    
        [activityIndicator stopAnimating];
    
    }
    
    - (void) threadStartAnimating {
        [activityIndicator startAnimating];
    }
    

    Good luck!
    -Karoly

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

Sidebar

Related Questions

I have a form which I want to submit upon button click which is
I have a button which is in update panel. When I click on button
When I click on a button which is outside of the GridView in my
Typical jQuery over-use: $('button').click(function() { alert('Button clicked: ' + $(this).attr('id')); }); Which can be
I have an ASP.NET page which has a button it it. The button click
i got a client side javascript function which is triggered on a button click
I am using UpdatePanel to trigger a button click event, which saves some 100+
On a click of a button named Add Textbox it calls a function which
I have a div which opens when I click a menu button, I am
I have an ajax modal popup, which is shown on click of a button

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.