Created
November 19, 2013 17:09
-
-
Save hebertialmeida/7548793 to your computer and use it in GitHub Desktop.
Set Keyboard Appearance of UISearchBar, iOS 5 to iOS 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)customKeyboardOnSearchBar:(UISearchBar *)searchBar | |
{ | |
for(UIView *subView in searchBar.subviews) { | |
if([subView conformsToProtocol:@protocol(UITextInputTraits)]) { | |
[(UITextField *)subView setKeyboardAppearance:UIKeyboardAppearanceAlert]; | |
[(UITextField *)subView setReturnKeyType:UIReturnKeyDone]; | |
} else { | |
for(UIView *subSubView in [subView subviews]) { | |
if([subSubView conformsToProtocol:@protocol(UITextInputTraits)]) { | |
[(UITextField *)subSubView setReturnKeyType:UIReturnKeyDone]; | |
[(UITextField *)subSubView setKeyboardAppearance:UIKeyboardAppearanceAlert]; | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment