Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>When you say "only one set of animation is run" I'm assuming that means <code>greenCircleAppear</code> and <code>redCircleAppear</code> begin the sequence of images appearing and the user pressing a button. If that's the case, I'd recommend not using a <code>for</code> loop in <code>viewDidAppear</code> but instead have <code>viewDidAppear</code> initialize the current state and call a method that presents the next animation. When the animation is finished, have it call the method that presents the next animation. Something along these lines:</p> <p>Add this to the interface:</p> <pre><code>@interface ViewController () @property NSInteger currentIteration; @end </code></pre> <p>This is in the implementation:</p> <pre><code>- (void)viewDidAppear:(BOOL)animated { self.currentIteration = 0; [self showNextAnimation]; } - (void)greenCircleAppear:(id)arg1 finished:(id)arg2 context:(id)arg3 { //perform animation NSLog(@"green"); [self showNextAnimation]; } - (void)redCircleAppear:(id)arg1 finished:(id)arg2 context:(id)arg3 { //perform animation NSLog(@"red"); [self showNextAnimation]; } - (void)showNextAnimation { self.currentIteration = self.currentIteration + 1; if (self.currentIteration &lt;= 20) { //you should replace '20' with a constant int r = arc4random() % 2; NSLog(@"%i", r); if(r==1) { [self greenCircleAppear:nil finished:nil context: nil]; } else { [self redCircleAppear:nil finished:nil context: nil]; } } else { //do what needs to be done after the last animation } } </code></pre>
    singulars
    1. This table or related slice is empty.
    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