iOS에서 새로운 언어를 사용하여 키보드 확장자를 테스트하고 있는데 keyPressed 이벤트에 대해 소리를 재생할 수 없으며 지연 시간이 있습니다. 지연 시간은 약 10 초입니다. 키. 어떤 의견이나 제안에 미리iOS 신속한 맞춤 키보드 소리 및 지연 없음
@IBAction func keyPressed(button: UIButton) {
var string = button.titleLabel!.text
(textDocumentProxy as UIKeyInput).insertText("\(string!)")
AudioServicesDisposeSystemSoundID(1104)
AudioServicesPlaySystemSound(1104)
UIView.animateWithDuration(0.2, animations: {
button.transform = CGAffineTransformScale(CGAffineTransformIdentity, 2.0, 2.0)
}, completion: {(_) -> Void in
button.transform =
CGAffineTransformScale(CGAffineTransformIdentity, 1, 1)
})
}
감사합니다 ... 당신은 다른 스레드에서 사운드를 재생해야
키를 누를 때마다 시스템 사운드가 왜 사라 집니까? 이것은 매우 비효율적 인 것 같습니다. – lxt
나는 didLoad에서 처리를 시도했지만 동일한 결과를 얻고 있습니다. – jezuz
저는이 코드를 기반으로합니다 : https://www.dropbox.com/s/gfewd0qekxr5u4i/CustomKeyboardFinal.zip?dl=0 – jezuz