How to disable search button in uisearchbar
Hi i want to disable search button in keyboard for uisearchbar. i have customized the search button.
iPhone 4S, iOS 5
Hi i want to disable search button in keyboard for uisearchbar. i have customized the search button.
iPhone 4S, iOS 5
When you say "customized the search button" have you customized the appearance of the search button on the search bar using something like setImage:forSearchBarIcon:state:? How does that necessitate disabling the keyboard button?
You can enumerate the UISearchBar subviews to get the UITextField. That allows some control over the keyboard. But not enabling/disabling a key button. This example shows the Done button instead of the Search button when entering text in the search bar.
// searchBar is an IBOutlet for the UISearchBar on the view
for (UIView *subview in searchBar.subviews) {
if ([subview conformsToProtocol:@protocol(UITextInputTraits)])
[(UITextField *)subview setReturnKeyType:UIReturnKeyDone];
Read this question that might be similar to yours. One solution appears to use a private API so is probably not useful.
How to disable search button in uisearchbar