我目前正在尝试全局设置键盘样式,但我的方法不起作用。
我尝试使用 UIAppearance
并将这行代码放在 AppDelegate 中:
[[UITextField appearance] setKeyboardAppearance:UIKeyboardAppearanceAlert];
但是我在控制台上得到的是以下内容:
[UISearchBarTextField _UIAppearance_setKeyboardAppearance:]: unrecognized selector sent to instance 0xa1897e0
有什么解决办法吗?
最佳答案
iOS7 为 UITextFields 扩展了 UIAppearance
协议(protocol),因此您现在可以在 UITextField 上设置 keyboardAppearance。
[UITextField appearance].keyboardAppearance = UIKeyboardAppearanceDark;
但是,UITextView
不支持它。对于这门课,我会选择 jszumski 的解决方案
关于ios - 如何为整个App设置UIKeyboard-Style?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14632984/