Conforming to UITableViewDataSource


#1

we have implemented 2 methods
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

from “UITableViewDataSource” protocol in “itemsViewController.m”, but we have not included this protocol in header file in brackets “< >”. Still the program works fine, How or Why?

@interface ItemsViewController : UITableViewController

thanks
Sachin


#2

I was curious about this as well, so I looked up UITableViewController in the documentation (the superclass).

It turns out UITableViewController conforms to both the UITableViewDelegate and UITableViewDataSource protocols. UITableViewController apparently has at least stubs for the required methods from UITableViewDataSource (tableView:cellForRowAtIndexPath: and tableView:numberOfRowsInSection).