I wanted to implement a UISearchDisplayController like controller to display search results, and added some log to figure out the logic.
After I saw the logs, I am very curious about how the UISearchDisplayController steals the UISearchBar events.
UISearchDisplayController works without setting the UISearchBarDelegate to itself. And the UISearchBarDelegate is working at the same time outside!
Here are the logs:
searchBarShouldBeginEditing:
searchBarTextDidBeginEditing:
searchDisplayControllerWillBeginSearch:
searchDisplayController:didLoadSearchResultsTableView:
searchBar:shouldChangeTextInRange:replacementText:
searchBar:textDidChange:
searchDisplayController:shouldReloadTableForSearchString:
searchDisplayController:willShowSearchResultsTableView:
searchDisplayController:didShowSearchResultsTableView:
searchBarCancelButtonClicked:
searchBarShouldEndEditing:
searchBarTextDidEndEditing:
searchDisplayController:willHideSearchResultsTableView:
searchDisplayController:didHideSearchResultsTableView:
searchBarShouldBeginEditing:
searchBarTextDidBeginEditing:
searchDisplayControllerWillBeginSearch:
searchBar:shouldChangeTextInRange:replacementText:
searchBar:textDidChange:
searchDisplayController:shouldReloadTableForSearchString:
searchDisplayController:willShowSearchResultsTableView:
searchDisplayController:didShowSearchResultsTableView:
searchBar:shouldChangeTextInRange:replacementText:
searchBarSearchButtonClicked:
searchBarShouldEndEditing:
searchBarTextDidEndEditing:
searchBarCancelButtonClicked:
searchDisplayController:willHideSearchResultsTableView:
searchDisplayController:didHideSearchResultsTableView: