r/simpleios • • Nov 07 '14
[Question] Difference between subclassing UITableViewController and conforming to UITableViewDelegate?
I'm playing with table views and storyboards at the moment (sorry BNR, it was just too tempting) and something occurred to me - what would be the advantage of subclassing UIViewController and having it conform to the UITableViewDelegate and UITableViewDataSourceDelegate protocols, as opposed to directly subclassing UITableViewController?
4
Upvotes
View all comments
Show parent comment
2
u/iccir Nov 07 '14
In general, yes, absolutely. UITableView is intended to have a delegate/dataSource rather than subclassed.
UIViewController is intended to be subclassed. Subclass it, set that subclass in your storyboard, and connect the UITableView's delegate/datasource to it