If you are developing a custom keyboard and trying to match it with the background of the keyboard view, use this in your keyboard view controller, where you set up the view:
keyboardView.backgroundColor = view.backgroundColor
My viewDidLoad() in my keyboard view controller looks like this:
var keyboardView: UIView! let keyboardNib = UINib(nibName: "KeyboardView", bundle: nil) keyboardView = keyboardNib.instantiate(withOwner: self, options: nil) [0] as? UIView keyboardView.frame.size = view.frame.size keyboardView.backgroundColor = view.backgroundColor view.addSubview(keyboardView)
source share