I am playing an audio file in Swift for iOS 8. I need to be able to know when the sound is finished. How can I have a method executed when the sound is finished?
相关问题
- “Zero out” sensitive String data in Swift
- SwiftUI: UIImage (QRCode) does not load after call
- Get the NSRange for the visible text after scroll
- UIPanGestureRecognizer is not working in iOS 13
- What does a Firebase observer actually do?
相关文章
- Using if let syntax in switch statement
- Enum with associated value conforming to CaseItera
- Swift - hide pickerView after value selected
- Is there a Github markdown language identifier for
- How can I vertically align my status bar item text
- Adding TapGestureRecognizer to UILabel in Swift
- Attempt to present UIAlertController on View Contr
- Swift - Snapshotting a view that has not been rend
It depends on how you're playing it. Look for a delegate method, a notification, or an observable property whose state change can trigger a KVO notification.
For example, if you're using an AVAudioPlayer, its
delegate
gets notified by a delegate method, which you can find out about here: https://developer.apple.com/library/ios/documentation/avfoundation/reference/AVAudioPlayerDelegateProtocolReference/index.html#//apple_ref/doc/uid/TP40008068