Confused by View

Discussion in 'iOS Programming' started by freeme007, Feb 9, 2012.

  1. macrumors regular

    Joined:
    Sep 21, 2008
    #1
    I created a view controller class called ItemsViewController and it's a subclass of UITableViewController. From What I understand is that the UITableViewController is a subclass of UIViewController and UITableViewController inherits the View method from UIViewController. The UITableViewController has a UITableView. So when I do the following:
    Code:
    self.window.rootViewController = itemsViewController
    it loads an empty table view instead of a white screen, Why?
     
  2. macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #2
    That isn't the actual code, you're missing a semicolon.

    Share your actual code and we can explain it to you.
     
  3. macrumors member

    Joined:
    Feb 2, 2009
    #3
    Perhaps I am confused, but it seems like you answered your own question already.

    Your itemsViewController is a subclass of UITableViewController, but you are confused as to why it contains a TableView?

    A UITableViewController will load the TableView that is present in the associated xib. If no xib is present, it will provide you with a basic unconfigured TableView.

    Have you read the UITableViewController Class Reference? I am sure it explains this behavior pretty clearly.
     
  4. thread starter macrumors regular

    Joined:
    Sep 21, 2008
    #4
    What happened to the view that's been inherited from UIViewController which is an UIView ? So I guess the default view for UITableViewController is the UITableView, not the inherited UIView?
     
  5. macrumors 604

    chrono1081

    Joined:
    Jan 26, 2008
    Location:
    Isla Nublar
    #5
    I think we are all pretty confused what you are asking...

    If you have a UITableViewController then it would be safe to assume the UITableView is the default view (which is how you should set it) since the controller is the "messenger" so to speak between your instance of UITableView and your data.
     
  6. macrumors 6502

    Joined:
    Jan 21, 2008
    Location:
    Texas
    #6
    Because, as you said, it is a subclass of UITableViewController. If you want a blank white screen then make a subclass of UIViewController.
     
  7. macrumors 68030

    MattInOz

    Joined:
    Jan 19, 2006
    Location:
    Sydney
    #7
    As far as I know nothing. It's exactly where you left it.

    As I Understand...
    UITableViewController added a UITableView as a subview of the UIView it inherited when it subclassed UIViewController. When you add yourViewController to the viewContainer you are using the viewContainer looks for the that UIView from the origin UIViewController to add as a sub-view of it's view chain.
     

Share This Page