开发者

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;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜