I am developing an iPhone application for iOS 5.1. I built a UIViewController with a UITableView with a UISearchDisplayController and other views, all somehow related to the table. UIVIewController is a delegate and table data source and makes some settings (graphical and business related) with the table display and search controller. So far, everything was in order.
The problem is that now I want to place the same table (possibly with a different list of elements of the same type) in different controllers (on different screens of the application). I tried to add the tableView of my controller as a slave in other controllers, but it does not work. I tried to rebuild the table as a subclass of UIView (instead of the UIViewController) and add it as a preview, but it did not work (it loaded the view from the NIB file, but all its properties, including IBOutlets, where nil or 0x000000).
After a lot of searching, I did not find an example of reusing tableview in different controllers. Any hint? Any example? Should I create it as a UIViewController or UIView? Which class should be the delegate of the table and searchdisplay, bearing in mind that most of the logic that I want to reuse is the code in the delegates?
Thanks to everyone in advance.
source
share