Reputation: 152
I'm using a custom UITableViewController (myTblController) as a member variable in another UIViewController (MainViewController).
Iam using the addSubView to add the tableview of myTblController on MainViewController.
Is it possible to use the delegate and datasource functions implemented in the myTblController instead of implementing table delegates function in MainViewController
in another words : i don't want to implement any TableView delegate or DataSource in my ViewController
Thanks.
Upvotes: 1
Views: 154
Reputation: 17732
Yes, the dataSource
and delegate
properties on the tableView are set independently of the actual parent view. All you need to do is set them in interface builder, or in your code like this:
tableView.dataSource = myTblController;
tableView.delegate = myTblController;
myTblController
being an actual instance of the class, I'm not sure if thats your class name or an instance name.
Upvotes: 1