[英]UISearchBar keyboard appearance
According to this question, we can change keyboard appearance of any UITextField in iOS Can the alert keyboard be used for any text field on iOS? 根据此问题,我们可以在iOS中更改任何UITextField的键盘外观警报键盘可以用于iOS上的任何文本字段吗?
But what about the UISearchBar? 但是UISearchBar呢? Is there a way for that, because
[searchBarInstance setKeyboardAppearance:UIKeyboardAppearanceAlert];
有没有办法解决这个问题,因为
[searchBarInstance setKeyboardAppearance:UIKeyboardAppearanceAlert];
doesn't work, since UISearchBar lacks of this method. 不起作用,因为UISearchBar缺少此方法。
you can do like this, 你可以这样
for(UIView *subView in searchBar.subviews)
if([subView isKindOfClass: [UITextField class]])
[(UITextField *)subView setKeyboardAppearance: UIKeyboardAppearanceAlert];
see iPhone UISearchBar & keyboardAppearance 请参阅iPhone UISearchBar和键盘外观
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.