Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Fritzables

macrumors regular
Original poster
May 6, 2011
149
1
Brisbane AUSTRALIA
Hi All,

I am creating a simple app to help better learn iOS programming.

I have a UIViewController where I have placed various controls onto.

Is it quiet legal to place a UITableView onto this Controller or MUST I use UITableViewController??

Pete
 
UITableViewController is merely a sub-class of UIViewController which places a UITableView in the host view and does some of the other work required to get the UITableView to work for you.

Nothing to stop you doing the work yourself and starting with a Plain UIViewController, it's probably good to do it once to know what it's doing.
 
Hi All,

I am creating a simple app to help better learn iOS programming.

I have a UIViewController where I have placed various controls onto.

Is it quiet legal to place a UITableView onto this Controller or MUST I use UITableViewController??

Pete

Nope.

Indeed, it's common to do this when you have view elements other than just a table view. The typical pattern in this case is for your UIViewController to implement the UITableViewDataSource and UITableViewDelegate protocols. You can copy the template code from an instance of UITableViewController (just create one that you're going to copy from, then throw it away after you copy the code). Don't forget to assign self to the tableView.delegate and tableView.dataSource properties.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.