views:

22

answers:

4

ViewDidLoad doesnt work. ViewDidappear Doesnt work.

No matter what happens, the sound is played then the viewController image is displayed.

What I want is the image to be displayed, then the sound plays simultaneously'

A: 

did you try viewWillAppear?

A: 

That could be because things happen in SEQUENCE unless you give explicit instructions that you want things to happen at the same time. If you want a sound to play WHILE an image is loading you need to use threads.

This guide explains how to accomplish that

willcodejavaforfood
A: 

I think viewWillAppear might work. viewDidLoad only gets called once, so it wouldn't get played every time a view controller is pushed.

jkeesh
A: 

I ended up making the sound effect have an extra 1 second pause at the beginning of it and playing it in viewdidappear. Not the perfect solution, but it was the easiest.

The sound was originally being played, before the phone actually rendered the viewcontroller, which I found counter intuitive seeing as the method 'viewdidappear' kinda sounds like the view should have erm already appeared.

Does that make sense?

David