1


I make a custom keyboard, this one GitHub of My First Custom Keyboard:

enter image description here

but it looks so tight.
I have searched a method to make it bigger and i found that

var heightConstraint: NSLayoutConstraint!

override func updateViewConstraints() {
    super.updateViewConstraints()
    let customHeight = UIScreen.main.bounds.height / 2

    if heightConstraint == nil {
        heightConstraint = NSLayoutConstraint(item: view,
                                              attribute: .height,
                                              relatedBy: .equal,
                                              toItem: nil,
                                              attribute: .notAnAttribute,
                                              multiplier: 1,
                                              constant: customHeight)
        heightConstraint.priority = UILayoutPriority(UILayoutPriorityRequired)
        print("Setuped")
        view.addConstraint(heightConstraint)
    }
    else {
        print("2")
        heightConstraint.constant = customHeight
    }
}

But it doesn't work on my custom keyboard, nothing happens so i have downloaded a bigger custom keyboard made from this Question
Link: GitHub of Downloaded Keyboard:

enter image description here

This keyboard have a perfect height but when i add a button he doesn't work anymore :/ GitHub of Edited by me Downloaded Keyboard
So if someone can make my first custom keyboard taller or add a button on the downloaded keyboard, it will be kind

Rombond
  • 129
  • 2
  • 11

1 Answers1

0

What is it doing if you change the toItem: nil to the top superView ?