In my App I'm using a custom keyboard. Not the kind of app extension that requires users to install the keyboard and then be able to use it anywhere - Just in my app.
To do this, I have created a subclass of UIInputViewController
and set my keyboard in a custom nib file. Then, on the textfields I require this keyboard to be shown, it calls the inputView of the UIInputViewController
.
This is the code calling 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
}
This gives you an idea what my code looks like so far. What I want to do now is to set the height of this keyboard to a custom value, say 200. I have scanned google and SO and all solutions I find are either iOS 8 only, or indicate not to be working with a nib file. I think it would be useful to have some knowledge on how to go about this in iOS 9 and WITH a nib too.
How do I change the height of my custom UIInputViewController in iOS 9 with a nib?