Cancel Button in UISearchController

后端 未结 3 791
名媛妹妹
名媛妹妹 2020-12-17 09:32

In my project I\'m using a UITableViewController with an internal UISearchController to filter the data in my tableView.

I ha

3条回答
  •  半阙折子戏
    2020-12-17 10:26

    You need to set the UISearchController searchBar's delegate. Once you have done this, the addition of the delegate method searchBarCancelButtonClicked: will properly be called.

    self.searchController.searchBar.delegate = self;
    
    - (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
    }
    

提交回复
热议问题