0
我正在製作一個暫停和播放聲音的按鈕。這裏是我的編碼:錯誤:'else'之前的預期表達式
.H:
@interface RootViewController : UIViewController {
}
@property (nonatomic, retain) AVAudioPlayer *theAudio;
-(IBAction)pause;
@end
.M:
- (void)viewDidLoad {
NSString *path = [[NSBundle mainBundle] pathForResource:@"MathMusic1" ofType:@"wav"];
self.theAudio = [[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL] autorelease];
theAudio.delegate = self;
[theAudio play];
theAudio.numberOfLoops = -1;
[super viewDidLoad];
}
現在我試圖讓一個按鈕,所以這裏暫停這是編碼:(已經在聲明.H)
-(IBAction)pause {
[theAudio pause];
else // expected expression before 'else'
[theAudio play];
}
/錯誤:前預期表達 '中的其他'