UITextView KeyboardAppearance property to set UIKe

2019-03-18 17:00发布

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.

1条回答
走好不送
2楼-- · 2019-03-18 17:57

There are 2 simple ways to do this

  1. Programmatically

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

查看更多
登录 后发表回答