How to add buttons in custom keyboard extension programmatically

245 views Asked by At

I'm building a keyboard extension for iOS.

Currently I try to add the buttons/keys programatically like this:

let button = UIButton(frame: CGRect(x: 15, y: 15, width: 35, height: 20)

button.layer.borderColor = UIColor.white.cgColor

button.layer.borderWidth = 2
button.layer.cornerRadius = 5
button.backgroundColor = UIColor.white
self.view.addSubview(button)

If I try to run the app, the keyboard appears but no button/key is displayed. Do you know what's wrong with my code? So all in all I just want to know how I can add a button to my custom keyboard where x = 15 and y = 15.

0

There are 0 answers