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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:03:27+00:00 2026-06-07T14:03:27+00:00

Im displaying an activity indicator with an Alert View using: UIAlertView *Alert= [[UIAlertView alloc]

  • 0

Im displaying an activity indicator with an Alert View using:

 UIAlertView *Alert= [[UIAlertView alloc] initWithTitle:@"Loading"
                                               message:@"\n"
                                              delegate:self
                                     cancelButtonTitle:nil
                                     otherButtonTitles:nil];

UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];   
spinner.center = CGPointMake(139.5, 75.5); 
[Alert addSubview:spinner];
[spinner startAnimating];
[Alert show];    

[Alert dismissWithClickedButtonIndex:0 animated:YES];

The only thing is it disappears off the screen real quick, I would like to specify how long the alert stays on screen for, say two seconds, rather than the nano second its displayed for now. Im unsure how to go about/implement this, would I use some sort of NSTimer, if so some advice how to implement this would be very much 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-06-07T14:03:29+00:00Added an answer on June 7, 2026 at 2:03 pm

    Here is an example of how I would go about solving the problem using NSTimer and NSInvocation. I have not tested it, so might have some trouble with it.

    UIAlertView *Alert= [[UIAlertView alloc] initWithTitle:@"Loading"
                                                   message:@"\n"
                                                  delegate:self
                                         cancelButtonTitle:nil
                                         otherButtonTitles:nil];
    UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];   
    spinner.center = CGPointMake(139.5, 75.5); 
    [Alert addSubview:spinner];
    [spinner startAnimating];
    [Alert show];  
    NSMethodSignature *mySignature = [UIAlertView instanceMethodSignatureForSelector:@selector(dismissWithClickedButtonIndex:animated:)];
    NSInvocation *myInvocation = [NSInvocation invocationWithMethodSignature:mySignature];
    [myInvocation setSelector:@selector(dismissWithClickedButtonIndex:animated:)];
    [myInvocation setTarget:Alert];
    int buttonIndex = 0;
    bool isAnimated = YES;
    [myInvocation setArgument:&buttonClicked 
                      atIndex:2];
    [myInvocation setArgument:&isAnimated 
                      atIndex:3];
    NSTimer *t = [NSTimer scheduledTimerWithTimeInterval:2 
                                              invocation:myInvocation 
                                                 repeats:NO];  
    

    I still do not think this is the best answer to the question though. In most cases you should use the indicator until the work to be done is complete, not based on a time, especially not a time that can change or dependent on other factors.

    So the correct answer would be wait until the work is done and at that point dismiss the UIAlertView.

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

Sidebar

Related Questions

while restoring some data i am displaying a activity indicator..but i want the background
I have one activity which i am using for displaying Dialogs and as a
I have an activity which is displaying a web page using a WebView. Within
I am looking into displaying an activity when the service is first started so
I'm displaying some text with a TextView inside a ScrollView . The activity changes
I'm displaying records in a grid format from an ActiveRecord list using each_slice. What
I'm Displaying a video in my application ..i want to force the activity to
I am displaying some data in a ScrollView. On activity startup (method onCreate) I
I have option menu on my activity. I am displaying another activity on click
My scenario: I am populating a ListView in an activity that is displaying a

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.