ios - 如何为整个App设置UIKeyboard-Style?

标签 ios objective-c cocoa-touch uitextfield uiappearance

我目前正在尝试全局设置键盘样式,但我的方法不起作用。 我尝试使用 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/

相关文章:

ios - 如何从 subview Controller 中更改后退按钮文本?

ios - 确定触摸点属于哪个矩形

ios - 试图隐藏 UITableView 中的最后一行

iPhone 位图性能

objective-c - 使用 CoreData 关系计算摘要

ios - 从一个地方删除所有通知观察者

iOS:判断相册中的照片是否来自相机

ios编辑表格,键盘隐藏字段

ios - GameKit、GKGameSession 如何将玩家添加到 session 中并发送数据?

ios - 停止在 UITableViewCell 中重复值