swift ios keyboard extension - long press / press and hold

夙愿已清 提交于 2019-12-12 09:14:14

问题


I need to know how to add long press (press and hold) function to ios custom keyboard extension so that i con show multiple keys to chose one from.

expected design

my project structure

current code for keypress action - code can add the title of the button pressed as a new text into any proxy text field.

 @IBAction func keypress(sender: UIButton!){

let typedCharacter = sender.titleLabel?.text
    let proxy = textDocumentProxy as UITextDocumentProxy
    proxy.insertText(typedCharacter!)



}




func loadKeyboard(){

let keyboardNib = UINib(nibName: "View", bundle: nil)
    keyboardView = keyboardNib.instantiateWithOwner(self, options: nil)[0] as! UIView
    view.backgroundColor = keyboardView.backgroundColor
    view.addSubview(keyboardView)



}

Wish to see suggestions and a complete answer preferably

来源:https://stackoverflow.com/questions/36504386/swift-ios-keyboard-extension-long-press-press-and-hold

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!