UITableView ??

Discussion in 'iOS Programming' started by Fritzables, Jul 1, 2012.

  1. Fritzables macrumors regular

    Joined:
    May 6, 2011
    Location:
    Brisbane AUSTRALIA
    #1
    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
     
  2. MattInOz macrumors 68030

    MattInOz

    Joined:
    Jan 19, 2006
    Location:
    Sydney
    #2
    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.
     
  3. Ron C macrumors member

    Joined:
    Jul 18, 2008
    Location:
    Chicago-area
    #3
    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.
     

Share This Page