How to change keyboard background color in iOS?

Matthieu Lucas picture Matthieu Lucas · Mar 15, 2012 · Viewed 50.7k times · Source

I would like to know how to change the keyboard background color programmatically in iOS? The background is normally grey but I have already seen black background (behind letters).

Answer

A-Live picture A-Live · Mar 15, 2012

For the dark background use:

mytextfield.keyboardAppearance = UIKeyboardAppearanceAlert;

Read to find more information about UITextInputTraits (use UIKeyboardAppearanceDark at iOS 7+).