I have an app that commonly lists Wines throughout the app (full screen or in smaller UIViews). I call this ViewController normally, by allocating the View, assigning the delegate/etc to my main ViewController, and then populating the data via that delegate.
From a master View that wants to display wines on the screen:
wineListViewController = [[WineListViewController alloc] initWithWines:nil];
wineListViewController.navigationController = self.navigationController;
self.winesTableView.dataSource = wineListViewController;
self.winesTableView.delegate = wineListViewController;
// Table population code goes here
That's great but now I'm building a Search aspect, and I want to use this same Viewcontroller for displaying the results since I have some complex rules in cellForRowAtIndexPath and such.
However, the UISearchDisplayController wants to use its own tableView, which would mean I'd have to duplicate all my code from WineListViewController (heightForRow,cellForRow) just to display the same way. Is there a way I can connect my WineListViewController into the UISearchDisplayController so I'm not duplicating code?