The typical UITableView usage pattern is to have the main UIViewController become a target datasource and delegate for the UITableView it is holding on to.
Are there any simple and easy to follow tutorials that would help me figure out how to move the code that pertains to the UITableViewDelegate and UITableViewDataSource methods into a separate class and hook that to my UIViewController instead? I would ideally like to have both the delegate and datasource living in the same class.
Right now, I am creating the UITableView via Interface Builder and connecting its outlet to my controller class.
Typical code:
@interface MyController : UIViewController <UITableViewDelegate, UITableViewDataSource>
{
IBOutlet UITableview *myTableview;
}
I want to do something more like this:
@interface MyController : UIViewController
{
IBOutlet UITableview *myTableview;
}
@end
@interface MyTableSourceDelegate : NSObject<UITableViewDelegate, UITableViewDataSource>
{
}
@implementation MyTableSourceDelegate
// implement all of the UITableViewDelegate and methods in this class
@end