1
我有以下代碼:異步聽起來
SystemSoundID soundID;
NSString *soundFile = [[NSBundle mainBundle] pathForResource: _sound ofType:@ "wav"];
AudioServicesCreateSystemSoundID((__bridge CFURLRef) [NSURL fileURLWithPath:soundFile], &soundID);
AudioServicesPlaySystemSound(soundID);
[UIView animateWithDuration: 0.6f
delay: 0.1f
options: UIViewAnimationTransitionCurlUp
animations:^{
[appDelegate.presstobook setFrame: CGRectMake(136, appDelegate.window.frame.size.height - 50, 47, 47)];
}
completion:^(BOOL finished){
presstobook = NO;
}
];
我怎樣才能做到這一點使聲音播放,而不影響其他代碼?我不想播放聲音來暫停代碼?如何更改代碼,以便在不影響其餘代碼的情況下異步播放聲音?謝謝!