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

freeme007

macrumors regular
Original poster
Sep 21, 2008
147
0
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?
 
That isn't the actual code, you're missing a semicolon.

Share your actual code and we can explain it to you.
 
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.
 
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.

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?
 
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?

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.
 
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?

Because, as you said, it is a subclass of UITableViewController. If you want a blank white screen then make a subclass of UIViewController.
 
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?

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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.