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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:44:51+00:00 2026-05-22T11:44:51+00:00

I have several UIAlertViews that i want to display in a sequential order, and

  • 0

I have several UIAlertViews that i want to display in a sequential order, and only move on to display the next UIAlertView once the previous one has been dismissed (by user clicking okay).

I know about the didDismissWithButtonIndex delegate and adding a tag, but this doesn’t really help too much as there could be upto 3 UIAlertViews invoked and not necessarily in the same order everytime. see code:

if(condition 1){
    alert1 = // UIAlertView[[.....
    [alert1 show]
}

if(condition 2){
    alert2 = // UIAlertView[[.....
    [alert2 show]
}

if(condition 3){
    alert3 = // UIAlertView[[.....
    [alert3 show]
}

The above will just add 3 Alerts on top of each other (depending on how many conditions are met) which is not what I want. I want to be able to only show one at a time and then the next one (if there is one) after the user hits the ok button.

I had the idea of maybe adding the messages to a queue and then processing that queue removing the alert every time an alert is dismissed but i’m not sure how id go about doing that.

Any ideas would be much appreciated.
Thanks

  • 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-22T11:44:52+00:00Added an answer on May 22, 2026 at 11:44 am

    You could easily do it in the UIAlertView delegate method, called once an alert view is dismissed. So, UIAlertViewDelegate defines the following delegate method:

    – alertView:didDismissWithButtonIndex:
    

    Implement that method, and make sure your class is the delegate of the UIAlertViews you create. This method is the perfect place to then show the next alert based on the one being dismissed by the user.

    If your requirement is “Display up to three alerts, sequentially, but not always in the same order” i’d probably put the alerts in to an array, and then in the delegate method get the next alert out of the array to show. It doesn’t have to be any more complex than that really; the key thing is that the delegate method implementation is the best place to show the next alert.

    Pseudo Code Example:

    Define an array; NSMutableArray * alerts_;

    - (void)showAlertSequence {
        if ( !alerts_ ) {
            alerts_ = [[NSMutableArray alloc] init];
        }
    
        [alerts_ addObjects;<My alerts>];
    
        [self showSequencedAlertFrom:nil];
    }
    
    - (BOOL)showSequencedAlertFrom:(UIAlertView *)sourceAlertView {
    
        if ( !sourceAlertView ) {
            [[alerts_ objectAtIndex:0] show];
        }
        else {
            NSInteger index = [alerts_ indexOfObject:sourceAlertView];
    
            if ( index < [alerts_ count] ) {
                [[alerts_ objectAtIndex:index++] show];
            }
        }
    
        return NO;
    }
    
    – alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)index {
    
        // Show the next alert or clean up if we're at the end of the sequence.
        if ( ![self showSequencedAlertFrom:alertView] ) {
            [alerts_ removeAllObjects];
        }
    }   
    

    As an aside; three sequential alerts will really annoy you users 😉

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

Sidebar

Related Questions

I have a UIAlertView with several buttons. I want to make a certain button
I have several strings that are being combined to make a URI. I want
I have several xml files with different node structure. I want to extract xml
I have several HTML elements (buttons) that fire the same JQuery AJAX request. When
I have several Delphi programs that maintain connections to a database (some Oracle, some
I have several different numbers in a group that range in sizes and would
I have several xml files that are formated this way: <ROOT> <OBJECT> <identity> <id>123</id>
We have several offices around the US and one in India. Our IT department
I have several places where I need to display an alert and handle the
I have several CRUD operations to perform, each one on a collection of models

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.