Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITextView KeyboardAppearance property to set UIKeyboardAppearanceDark

I simply want the keyboard of UITextView to appear in dark mode. However UItextView doesn't have such a property.

Normally for UITextField you can use the following to change the keyboards across the app:

[[UITextField appearance] setKeyboardAppearance:UIKeyboardAppearanceDark];

However when I try the following, app crashes:

[[UITextView appearance] setKeyboardAppearance:UIKeyboardAppearanceDark];

So, my question is simple, is there a way to change keyboard appearance when I use UITextView? I hope and want to believe that Apple didn't forget to add such a feature to UITextView.

like image 451
Ömer Faruk Gül Avatar asked Feb 01 '14 21:02

Ömer Faruk Gül


1 Answers

There are 2 simple ways to do this

  1. Programmatically

    self.textView.keyboardAppearance = UIKeyboardAppearanceDark;
    
  2. Storyboard or nib file enter image description here

like image 170
Xu Yin Avatar answered Oct 01 '22 02:10

Xu Yin