Edward Anthony
Edward Anthony

Reputation: 3464

UITableViewDataSource Delegate

I created a new Master-Detail Application from Xcode template

I found that the main interface ( in this case BirdMasterViewController ) inherit from UITableViewController, and UITableViewController conform to UITableViewDataSource protocol

so I can specify methods like

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

But I did not find a set delegate to _dataSource variable on BirdMasterViewController, like

xxxxxx._dataSource = self; or setDataSource: self

to set _dataSource object

// to this
id <UITableViewDataSource>  _dataSource;

Why the delegation can run ?

Upvotes: 0

Views: 237

Answers (2)

Matt
Matt

Reputation: 2411

I'd recommend you also check out tableview frameworks such as the free Sensible TableView framework. Should make your tableview development lot easier.

Upvotes: 0

Divya Bhaloidiya
Divya Bhaloidiya

Reputation: 5064

Add delegate in your .h file and then use your delegate methods :

@interface BirdMasterViewController : UIViewController<UITableViewDelegate,UITableViewDataSource>

Upvotes: 2

Related Questions