Ios keyboard quick expansion - long press / press and hold

I need to know how to add a long press (press and hold) a function to extend the ios custom keyboard so that I can display several keys to select one of them.

expected design enter image description here

my project structure

enter image description here

current code for pressing a key - the code can add the title of a button pressed as new text to 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)



}

It is advisable to see the sentences and the full answer is preferable.

0
source share

All Articles