iPhone SDK: UISearchBar: searchBarTextDidEndEditing not firing

前端 未结 3 1583
心在旅途
心在旅途 2020-12-19 14:12

I\'m implementing a search bar on my table, which should be pretty straight forward. I\'ve got these:

- (void)searchBarTextDidBeginEditing:(UISearchBar *)the         


        
相关标签:
3条回答
  • 2020-12-19 15:01

    The method

    • (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar

    is only called when [searchBar resignFirstResponder] is called.

    The best place to call [searchBar resignFirstResponder] is in the method

    • (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar

    In swift:

    • (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar;
    • (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar;
    0 讨论(0)
  • 2020-12-19 15:06

    Once I implemented searchBarSearchButtonClicked that solved it for me.

    0 讨论(0)
  • 2020-12-19 15:16

    Even i faced the same problem.

    Please find with the solution below

    Implement Below methods

    1.searchBarTextDidEndEditing
    2.searchBarSearchButtonClicked

    and make sure you [UISearchchbar resignfirstresponder] in the second method mentioned above

    0 讨论(0)
提交回复
热议问题