1
如何使用同一段代碼製作play/Pause
按鈕。使用相同的按鈕播放/暫停
- (IBAction)min:(id)sender
{
NSString *path = [[NSBundle mainBundle] pathForResource:@"1min" ofType:@"mp3"];
AVAudioPlayer *theAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
theAudio.delegate = self;
theAudio.numberOfLoops = -1;
[theAudio play];
[[NSUserDefaults standardUserDefaults] setObject:@"-" forKey:@"music"];
}
我該如何恢復相同的按鈕?
能請寫//播放更多的細節和//暫停部分? –
@JangSejin試試我的更新回答.. –
非常感謝你 –