Nikita Pestrov
Nikita Pestrov

Reputation: 5966

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?

But what about the UISearchBar? Is there a way for that, because [searchBarInstance setKeyboardAppearance:UIKeyboardAppearanceAlert]; doesn't work, since UISearchBar lacks of this method.

Upvotes: 0

Views: 1261

Answers (1)

Venk
Venk

Reputation: 5955

you can do like this,

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

see iPhone UISearchBar & keyboardAppearance

Upvotes: 5

Related Questions