I've created a custom keyboard and implemented the:
class KeyboardViewController: UIInputViewController
The imlementation looks like this:
override func viewDidLoad() {
super.viewDidLoad()
var stack = UIStackView()
stack.axis = .vertical
stack.spacing = 8
stack.translatesAutoresizingMaskIntoConstraints = false
stack.distribution = .fill
stack.heightAnchor.constraint(equalToConstant: 200).isActive = true
....
view.addSubview(stack)
NSLayoutConstraint.activate([
stack.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 20),
stack.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -20),
stack.topAnchor.constraint(equalTo: view.topAnchor, constant: 10),
stack.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -10)
])
The problem is that the keyboard seems to start showing in the size (I've printed the parent frame):
Optional(<UIView: 0x101008480; frame = (0 0; 390 844); autoresize = W+H; layer = <CALayer: 0x600000207b80>>)
and than resizes to my given height. But it's not fast enough so that I can see some glitches whenever I switch from another keyboard to my custom keyboard.
Is there a way to prevent this resizing or start the keyboard in a given size? This is just not the best user experience.