Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the UIKeyboard-Style for the whole App?

I am currently trying to set the keyboard style globally, but my approach does not work. I tried it using UIAppearance and put this line of code inside the AppDelegate :

[[UITextField appearance] setKeyboardAppearance:UIKeyboardAppearanceAlert];

But what I got on the console is the following:

[UISearchBarTextField _UIAppearance_setKeyboardAppearance:]: unrecognized selector sent to instance 0xa1897e0

Any ideas how to solve this?

like image 316
Sebastian Boldt Avatar asked Dec 26 '22 10:12

Sebastian Boldt


1 Answers

iOS7 extended the UIAppearance protocol for UITextFields, ergo you can set now the keyboardAppearance on UITextField.

[UITextField appearance].keyboardAppearance = UIKeyboardAppearanceDark;

However, UITextView doesn't support it. For this class, I would go with jszumski's solution

like image 89
bhr Avatar answered Jan 08 '23 18:01

bhr