UITextView KeyboardAppearance属性设置UIKeyboardAppearanceDark [英] UITextView KeyboardAppearance property to set UIKeyboardAppearanceDark
问题描述
我只是希望UITextView的键盘以暗模式显示.但是UItextView没有这样的属性.
I simply want the keyboard of UITextView to appear in dark mode. However UItextView doesn't have such a property.
通常对于UITextField,您可以使用以下命令在应用程序中更改键盘:
Normally for UITextField you can use the following to change the keyboards across the app:
[[[UITextField外观] setKeyboardAppearance:UIKeyboardAppearanceDark];
但是,当我尝试以下操作时,应用程序崩溃:
However when I try the following, app crashes:
[[UITextView外观] setKeyboardAppearance:UIKeyboardAppearanceDark];
所以,我的问题很简单,当我使用UITextView时,是否可以更改键盘外观?我希望并希望相信Apple不会忘记将此类功能添加到UITextView.
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.
推荐答案
有两种简单的方法可以做到这一点
There are 2 simple ways to do this
-
以编程方式
Programmatically
self.textView.keyboardAppearance = UIKeyboardAppearanceDark;
故事板或nib文件
Storyboard or nib file
这篇关于UITextView KeyboardAppearance属性设置UIKeyboardAppearanceDark的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!