UISearchBar键盘外观

时间:2012-10-06 11:11:19

标签: iphone ios keyboard uisearchbar

根据这个问题,我们可以更改iOS Can the alert keyboard be used for any text field on iOS?中任何UITextField的键盘外观

但是UISearchBar怎么样?有没有办法,因为[searchBarInstance setKeyboardAppearance:UIKeyboardAppearanceAlert];不起作用,因为UISearchBar缺少这种方法。

1 个答案:

答案 0 :(得分:5)

你可以这样做,

for(UIView *subView in searchBar.subviews)
  if([subView isKindOfClass: [UITextField class]])
    [(UITextField *)subView setKeyboardAppearance: UIKeyboardAppearanceAlert];

请参阅iPhone UISearchBar & keyboardAppearance