-3
試圖將下面的代碼objective-c
轉換爲Swift
,請幫助我這麼做或幫助我使用新代碼播放多聲音***代碼幫助播放多個聲音(目標c)Swift(xcode 7)
- (IBAction)pushButton {
NSString *path = [[NSBundle mainBundle] pathForResouce:@"ring" ofType:@"mp3"];
if(theAudio) [theAudio release];
theAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
theAudio.delegate = self;
[theAudio play];
}
- (IBAction)pushButton1 {
NSString *path = [[NSBundle mainBundle] pathForResouce:@"amaze" ofType:@"mp3"];
if(theAudio) [theAudio release];
theAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
theAudio.delegate = self;
[theAudio play];
}
**這是不是一個編碼服務**。至少在你身邊顯示出一些努力! –
我從過去2周(每天5小時)開始就是爲了讓它發揮作用。可以這樣做 – Shahdeep
你做了什麼?發佈! –