当用户点击搜索文本字段时,我想将键盘的颜色更改为黑色。
我试图通过以下方式实现它UITextField *textField = [UITextField appearance];
[textField setKeyboardAppearance:UIKeyboardAppearanceAlert];
但我的构建失败并显示此消息
由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[UISearchBarTextField _UIAppearance_setKeyboardAppearance:]:无法识别的选择器发送到实例 0x8485260”
请问你能帮我吗?
多谢
使用此代码...
for(UIView *searchTextfield in yourSearchBar.subviews)
{
if([searchTextfield isKindOfClass: [UITextField class]]){
[(UITextField *)searchTextfield setKeyboardAppearance: UIKeyboardAppearanceAlert];
}
}
它与我的另一个答案相同,其中我替换了按钮 Image see..uisearchbar 的取消按钮图像 https://stackoverflow.com/questions/14019719/image-for-cancel-button-of-uisearchbar/14019754#14019754
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)