Take the 2-minute tour ×

Is is possible to use the same UISearchDisplayController/UISearchbar/UISearchDisplayController ResultsTable logic across multiple views?

I have an application which utilizes 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

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

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).

share|improve this answer
hmm i guess this is my only option, thought there may be a more elegant solution. Although i believe i am already slightly stretching UISearchDisplayController beyonds it's intentional means and thus isn't designed to be used across multiple Classes. –  Alex Jun 5 '11 at 21:28
add comment

Your Answer


