我正在用iOS上的新语言swift测试键盘扩展,但我无法播放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 2014-11-02 04:53:17
我试过在didLoad处置,但我得到了相同的结果。 – jezuz 2014-11-02 04:56:41
我基于以下代码:https://www.dropbox.com/s/gfewd0qekxr5u4i/CustomKeyboardFinal.zip?dl=0 – jezuz 2014-11-02 05:18:41