Set Keyboard Appearance of UISearchBar


/ Published in: Objective C
Save to your folder(s)

This will set the keyboard appearance of the UISearchBar text field to be black and see through.


Copy this code and paste it in your HTML
  1. // Set the return key and keyboard appearance of the search bar
  2. for (UIView *searchBarSubview in [tableSearchBar subviews]) {
  3. if ([searchBarSubview conformsToProtocol:@protocol(UITextInputTraits)]) {
  4. @try {
  5. [(UITextField *)searchBarSubview setReturnKeyType:UIReturnKeyDone];
  6. [(UITextField *)searchBarSubview setKeyboardAppearance:UIKeyboardAppearanceAlert];
  7. }
  8. @catch (NSException * e) {
  9.  
  10. // ignore exception
  11. }
  12. }
  13. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.