tags:

views:

26

answers:

1

I want to disable a method from running if my audio clip is playing.

I have myImage.hidden working if the audio.playing is running, how would I go about disabling a method in the same way?

if (audio.playing == YES) {
    // image is hidden
    myImage.hidden = YES;
}
+3  A: 

Put this code at the top of your method:

if (audio.playing) {
    return;
}
Rits
thanks, that worked. one more thing if you have the time. if I want to disable the same method if the user leaves the view, what would I put in the:-(void)viewWillDisappear:(BOOL)animated {} method? my method is -(void) runAnimation;
hanumanDev
You could use a variable like `disableRunAnimationMethod` and set it to `YES` in your `viewWillDisappear:` method. Then at the top of `runAnimation`, you change the code to `if (audio.playing || disableRunAnimationMethod) {...}`.
Rits
thanks again. I'll give it a try.
hanumanDev