Confused by View

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

  1. freeme007 macrumors regular

    Sep 21, 2008
    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:
    self.window.rootViewController = itemsViewController
    it loads an empty table view instead of a white screen, Why?
  2. ArtOfWarfare macrumors G3


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

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

    Feb 2, 2009
    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. freeme007 thread starter macrumors regular

    Sep 21, 2008
    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. chrono1081 macrumors 604


    Jan 26, 2008
    Isla Nublar
    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. jonnymo5 macrumors 6502

    Jan 21, 2008
    Because, as you said, it is a subclass of UITableViewController. If you want a blank white screen then make a subclass of UIViewController.
  7. MattInOz macrumors 68030


    Jan 19, 2006
    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