根据这个问题,我们可以更改iOS Can the alert keyboard be used for any text field on iOS?中任何UITextField的键盘外观
但是UISearchBar怎么样?有没有办法,因为[searchBarInstance setKeyboardAppearance:UIKeyboardAppearanceAlert];
不起作用,因为UISearchBar缺少这种方法。
答案 0 :(得分:5)
你可以这样做,
for(UIView *subView in searchBar.subviews)
if([subView isKindOfClass: [UITextField class]])
[(UITextField *)subView setKeyboardAppearance: UIKeyboardAppearanceAlert];