objective c - Making a button play and pause background sound -


i have errors code:

-(ibaction)pause {     [theaudio pause];      if [theaudio pause] {     else {         [theaudio play];     } } } 

i new c , xcode , not sure do. please provide right code in relation this.

the code posted has syntax errors, should following:

-(ibaction)pause {           if ([theaudio ispaused]) {         [theaudio play];     } else {         [theaudio pause];     } } 

i have no idea if theaudio object has ispaused method, in if statement should checking whether audio playing or not, , use set audio play or pause.


Comments