How do I force one method to be executed before another method?
- by RexOnRoids
I've got 2 methods. One method starts playing an audio file (.mp3), the other method updates a UIToolBar to show a button (PLAY or PAUSE). These two methods are called in the following order:
//Adds some UIBarButtonItems to a UIToolBar
[self togglePlayer];
//Uses AVAudioPlayer
[audioPlayer play];
I call the methods in the above order so that the (pause) button will be shown at the time the song starts playing. But, the problem is that the song starts playing first, and the UIToolBar remains unchanged for quite a while (from 2 to 5 secs) until the button is added and shown.
What I want is for the button to be shown at the same time the song starts playing (i.e. NO DELAY). Is there any way to do this?