I'm making a custom keyboard in iOS8 and I'd like to be able to increase and decrease the size of the keyboard. I know from the iOS documentation that you can increase the height of the keyboard after it has loaded using this code:
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
let expandedHeight:CGFloat = 500
let heightConstraint = NSLayoutConstraint(item:self.view,
attribute: .Height,
relatedBy: .Equal,
toItem: nil,
attribute: .NotAnAttribute,
multiplier: 0.0,
constant: expandedHeight)
self.view.addConstraint(heightConstraint)
}
But the problem with this code is, if the expandedHeight is 500 to begin with, if at a later time in the running of the keyboard I want to increase that to 600 for example, nothing happens and sometimes the keyboard crashes.
Is there any other way to increase and decrease the height of the keyboard that works when I increase the height?
Also I've been using a swipe up gesture to increase the height of the keyboard and a swipe down gesture to decrease it. Can you swipe up and down without lifting your finger and have it register as an up and a down gesture?