Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I gather you're trying to display <code>FirstViewController</code> after 11 seconds have elapsed in the audio track. <br/> You can set you timer up to poll (every .5 - 1.0 seconds) and if the audioPlayer's elapsed time is greater than 11.0, perform your action.</p> <pre><code>-(void)playpauseAction:(id)sender { if ([audioPlayer isPlaying]){ [sender setImage:[UIImage imageNamed:@"Play Icon.png"] forState:UIControlStateSelected]; [audioPlayer pause]; [self.timer invalidate]; // stop the polling timer } else { [sender setImage:[UIImage imageNamed:@"pause.png"] forState:UIControlStateNormal]; [audioPlayer play]; // start/resume the timer self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0 /* polling interval */ target:self selector:@selector(tryToDisplayViews:) userInfo:nil repeats:YES]; /* REPEAT = YES */ } } // the new polled method -(void)tryToDisplayViews:(id)sender { // need last current time as a new variable to ensure that we only add the view once // and not every time the method fires with currentTime &gt; 11.0 if( audioPlayer.currentTime &gt; 11.0 &amp;&amp; lastCurrentTime &lt; 11.0) { [self displayviewsAction:nil]; } // you can add the second view here in a similar fashion // if(audioPlayer.currentTime &gt; (23.0+11.0) &amp;&amp; lastCurrentTime &lt; (23.0+11.0) ) {} lastCurrentTime = audioPlayer.currentTime; } </code></pre> <p>This also get's rid of your <code>resumeTimer</code>/<code>pauseTimer</code> actions, you don't need to count the time paused.</p>
    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.
    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