Conforming to Protocols


I’m a bit confused that I don’t write <UITableViewDelegate, UITableViewDataSource> in ItemsViewController.h. Is this because ItemsViewController inherits conforming to these protocols by being a subclass of UITableViewController?



this is the Class Reference in the documentation:

UITableViewController Class Reference

Inherits from
UIViewController : UIResponder : NSObject
Conforms to
NSCoding (UIViewController)
UIAppearanceContainer (UIViewController)
NSObject (NSObject)

According to this post in Stackoverflow, the protocols are inherited to the subclasses. Since you are writing a UITableView Subclass, the protocol is automatically adopted.


If you check the header file for UITableViewController you’ll see that it declares self as the datasource and delegate. Therefor, you don’t need to add them to the @interface.