In the UISearchBar control, is the a way to change the Search key title for the keyboard to Done?
+7
A:
For a searchbar named tablesearchbar:
// Set the return key and keyboard appearance of the search bar
for (UIView *searchBarSubview in [tableSearchBar subviews]) {
if ([searchBarSubview conformsToProtocol:@protocol(UITextInputTraits)]) {
@try {
[(UITextField *)searchBarSubview setReturnKeyType:UIReturnKeyDone];
[(UITextField *)searchBarSubview setKeyboardAppearance:UIKeyboardAppearanceAlert];
}
@catch (NSException * e) {
// ignore exception
}
}
}
Run Loop
2010-04-24 20:51:49
It works. Fantastic answer. Many thanks.
Jim B
2010-04-25 22:52:29
Thanks JK! Helped me as well
ambertch
2010-04-30 00:37:51
Will this get past the App Store approval process?
zekel
2010-06-17 00:26:41
As no private APIs are accessed, approval should not be withheld
Run Loop
2010-06-17 05:53:57