views:

43

answers:

1

I have a custom UITableView class for creating shadow effects on all of my UITableViews. Is it possible to incorporate this class with my UITableViewController(s) without creating a nib file for each table view controller? Is there another way to link this custom UITableView other then in IB?

+1  A: 

Using a UITableViewController, set the delegate and datasource on your custom UITableView to the controller and then set that custom tableView instance as the UITableViewController's tableView property.

 [instanceOfMyCustomUITableView setDelegate:self];

 [instanceOfMyCustomUITableView setDataSource:self];

 [self setTableView:instanceOfMyCustomUITableView];

self being the instance of the UITableViewController

Jbonniwell
I seem to be getting some weird results from this. When trying to set [shadowTableView setdataSource:self] I get 'DetailViewController does not implement the 'UIPickerViewDataSource'. This seems a little odd since shadowTableView is a UITableView not a UIPickerView. Also, [self setTableView:shadowTableView] expects a struct UITableView not a ShadowedTableView. Any ideas?
avenged
My fault, I was forward-declaring the class instead of importing it in my UITableViewController interface. Works great now, thanks!
avenged