prevent search button from clearing search bar text
After clicking "search" on the keyboard, the search bar text clears. Is there a way to keep the text in the search bar? Why would it disappear?
Note: I'm using the se开发者_高级运维arch display controller to activate and deactive the search
I found this from a somewhat related question... but the following code should keep the search term visible when the user clicks the search button.
-(void) searchBarSearchButtonClicked:(UISearchBar *)searchBar {
NSString *str = searchBar.text;
[self.searchController setActive:NO animated:YES];
self.searchController.searchBar.text = str;
}
精彩评论