UISearchDisplayController across multiple views
Is is possible to use the same UISearchDisplayController/UISearchbar/UISearchDisplayController ResultsTable logic across multiple views?
I have an application which utiliz开发者_开发问答es a site wide search, using a UISearchBar above nearly every view, therefore i have a lot of duplication throughout the application as each view has a UISearchDisplayController and integrated conditional statements in the tableView's to display the results.
Is there a better approach? It feels wrong doing it this way and there must be a better approach that avoids all of this repetition.
I should point out that my application is a Navigation based application utilizing a UINavigationbar hierarchy
You could factor out the common code into it's own class, and then if there is any specific behavior needed by any one implementation, you can override specific methods (such as cellForRowAtIndexpath or didSelectCellForIndexPath).
精彩评论