-
-
Save haraldmartin/436063 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// By Henrik Nyh <http://henrik.nyh.se> 2010-06-12 under the MIT license. | |
#import <Foundation/Foundation.h> | |
@interface SearchBarStyler : NSObject { | |
} | |
+(void)enableReturnKeyWithNoText:(UISearchBar *)searchBar; | |
@end |
This file contains hidden or 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
#import "SearchBarStyler.h" | |
@implementation SearchBarStyler | |
+(void)enableReturnKeyWithNoText:(UISearchBar *)searchBar { | |
// Really a UISearchBarTextField, but that header is private. | |
UITextField *searchField = nil; | |
for (UIView *subview in searchBar.subviews) { | |
if ([subview isKindOfClass:[UITextField class]]) { | |
searchField = (UITextField *)subview; | |
break; | |
} | |
} | |
if (searchField) { | |
searchField.enablesReturnKeyAutomatically = NO; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment