Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You could easily do it in the UIAlertView delegate method, called once an alert view is dismissed. So, UIAlertViewDelegate defines the following delegate method:</p> <pre><code>– alertView:didDismissWithButtonIndex: </code></pre> <p>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 <em>next</em> alert based on the one being dismissed by the user.</p> <p>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 <em>show the next</em> alert.</p> <p><strong>Pseudo Code Example:</strong></p> <p>Define an array; NSMutableArray * alerts_;</p> <pre><code>- (void)showAlertSequence { if ( !alerts_ ) { alerts_ = [[NSMutableArray alloc] init]; } [alerts_ addObjects;&lt;My alerts&gt;]; [self showSequencedAlertFrom:nil]; } - (BOOL)showSequencedAlertFrom:(UIAlertView *)sourceAlertView { if ( !sourceAlertView ) { [[alerts_ objectAtIndex:0] show]; } else { NSInteger index = [alerts_ indexOfObject:sourceAlertView]; if ( index &lt; [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]; } } </code></pre> <p>As an aside; three sequential alerts will really annoy you users ;)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload