Posted By

suibhne on 01/24/11


Tagged

UISearchBar


Versions (?)

Set Keyboard Appearance of UISearchBar


 / Published in: Objective C
 

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

  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  

You need to login to post a comment.