Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As the other poster said, sleep is the problem. Sleep freezes the main thread. Forget that sleep exists. Never use it. The only time sleep is EVER valid is on a secondary thread, when you want that thread to stop running for a period, and then only if you really really know what you are doing with concurrency (a very advanced topic)</p> <p>What you should do is rewrite your animation code to use animateWithDuration:animations:completion:</p> <p>Provide a completion block that invokes the next animation using a nested call to animateWithDuration:animations:completion:</p> <p>Each animation will run to the end, and then invoke the next one. </p> <p>BTW, you should look at AVAudioPlayer. It is more powerful than AudioServices, and easier to use. You just create an AVAudioPlayer and tell it to play. </p> <p>If you want a step in your animation to wait for a sound to compete, AVAudioPlayer takes a delegate that it will call once the sound is done playing. </p> <p><strong>Here's how I would suggest reworking your animation sequence:</strong></p> <p>Before you begin your animation sequence, set up an AVAudioPlayer and make your view controller it's delegate. </p> <p>Write an animateWithDuration:animations:completion call where the animations block does your fade in. </p> <p>In the completion block, start an AVAudioPlayer playing. </p> <p>In the AVAudioPlayer delegate method audioPlayerDidFinishPlaying:successfully:, invoke another animateWithDuration:animations:completion: method to fade your view out again.</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