UITextView KeyboardAppearance property to set UIKeyboardAppearanceDark

瘦欲@ 提交于 2019-12-03 11:48:55

问题


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:


There are 2 simple ways to do this

  1. Programmatically

    self.textView.keyboardAppearance = UIKeyboardAppearanceDark;
    
  2. Storyboard or nib file



来源:https://stackoverflow.com/questions/21503906/uitextview-keyboardappearance-property-to-set-uikeyboardappearancedark

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!