Resize custom UIInputViewController in iOS 9 using nib

In my application, I use a custom keyboard. Not the kind of application extension that requires users to install a keyboard, and then it can be used anywhere - right in my application.

To do this, I created a subclass UIInputViewControllerand installed my keyboard in a custom nib file. Then in the text fields I need to show this keyboard, it calls inputView UIInputViewController.

This is the code that calls the keyboard:

let myKeyBoard = MyKeyboard()    
scoreField.inputView = myKeyBoard.inputView!
scoreField.becomeFirstResponder()

Then, in the UIInputViewController, this code is called:

class MyKeyboard: UIInputViewController {
var myKeyBoardView: UIInputView!

override func viewDidLoad() {
    super.viewDidLoad()

    self.loadInterface()
}

func loadInterface() {
    //load nib and set in view
    let nib = UINib(nibName: "MyKeyboard", bundle: nil)
    myKeyBoardView = nib.instantiateWithOwner(self, options: nil)[0] as! UIInputView
    self.inputView = myKeyBoardView
    view.backgroundColor = myKeyBoardView.backgroundColor
}

, . , 200. google SO, iOS 8, , nib. , , iOS 9 .

UIInputViewController iOS 9 nib?

+4

Source: https://habr.com/ru/post/1627938/


All Articles