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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:27:09+00:00 2026-06-06T13:27:09+00:00

I have a time-consuming step to be done, if the user clicks on a

  • 0

I have a time-consuming step to be done, if the user clicks on a certain button on an uialertview. I would like to notify the user with an activity indicator while its being done. Im not sure what exactly needs to be done for the desired output. Here is the flow:

User clicks on button 1 ‘Build the tower’.

UIAlertview shown with “Do you want to do this, it takes time”

User clicks “YES”:
Now I am in the alertview Delegate method.

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{

if (buttonIndex == 1) {//Yes the user wants to do this
 //Show activity indicator here

    UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc]     initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];

    indicator.center = CGPointMake(alert.bounds.size.width / 2, alert.bounds.size.height - 50);
    [indicator startAnimating];
    [alertView addSubview:indicator];
    [indicator release];

//
[SimpleFunctions doThatMethodThatTakesALongTime];
 //remove activity indicator here

    }

}

Here, I want to show an activity indicator before the ‘big processing’ is done.

The examples of adding an activity indicator to alertview show how to add the indicator to the above alertview. But I don’t want that indicator to show up, until the user has clicked on ‘YES’.
Any pointers on how that can be achieved would be great. I hope I made the question clear, please let me know if not,

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-06-06T13:27:10+00:00Added an answer on June 6, 2026 at 1:27 pm

    Alert view reference: http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIAlertViewDelegate_Protocol/UIAlertViewDelegate/UIAlertViewDelegate.html

    In the delegate method - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex you can add things to the alertView there.

    E.g.

    - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
        UIActivityIndicator * ai = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
        [alertView addSubview:activityIndicator];
        activityIndicator.frame = CGRectMake(80, 0, 30, 30);
        [ai startAnimating];
    }
    

    You want to add ai as a ivar (class variable) in order to remove it later.

    [self.ai removeFromSuperview];

    Hope this helps.

    Edit: one thing to keep in mind is that this way you will probably have to manage dismissing of your alert view yourself. You can use the method - (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated on the alert view to dismiss it.

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

Sidebar

Related Questions

have one time consuming step that flattens a bunch of files. basically i'd like
I have a time consuming loop I would like to execute in parallel. Pseudocode:
I have a function a time consuming operation that is done I want to
I have a method that does a time consuming operation, say something like ten
In My application have time consuming process.There fore i try to do that operation
I have a time-consuming static C# method for creating an array (of double :s)
I have a ASP.NET MVC3 application that handles time-consuming processes (copying a large file
I have a Maven project which performs a number of time consuming tests as
I have time in NSString like 15:15 I want to covert this NSString time
I have a time-consuming method with non-predefined number of iterations inside it that I

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.