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
2010-10-08 00:25:02
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
2010-10-08 02:38:21
My fault, I was forward-declaring the class instead of importing it in my UITableViewController interface. Works great now, thanks!
avenged
2010-10-08 05:05:00