Reputation: 203
I have errors with my code:
-(IBAction)pause {
[theAudio pause];
if [theAudio pause] {
else {
[theAudio play];
}
}
}
I am very new to c and xcode and I am really not sure what to do. Please provide the right code in relation to this.
Upvotes: 0
Views: 669
Reputation: 43865
The code you posted has some syntax errors, it should look like the following:
-(IBAction)pause {
if ([theAudio isPaused]) {
[theAudio play];
} else {
[theAudio pause];
}
}
I have no idea if your theAudio
object has an isPaused
method, basically in the if statement you should be checking whether the audio is playing or not, and use that to set the audio to play or pause.
Upvotes: 0
Reputation: 104708
i suggest you team up with user 722566, and work through problems together:
Making a button play and pause background sound
error: expected expression before 'else'
it seems like you two have a lot of identical questions, at approximately the same time.
thanks
Upvotes: 2