iOS で新しい言語の Swift を使用してキーボード拡張機能をテストしていますが、keyPressed イベントのサウンドを再生できず、キーをクリックすると約 10 秒の遅延が発生します。
これは私のコードです:
@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)
})
}
コメントや提案をお寄せいただきありがとうございます...