Zhen
Zhen

Reputation: 12431

Add a UIView as a subview to a UITableViewController's view

I am trying to add a subview to a UITableViewController's view via the following code

//In a UITableViewController Implementation file
self.loadingPageView = [[[UIView alloc]initWithFrame:[UIScreen mainScreen].applicationFrame] autorelease];
self.loadingPageView.frame = self.view.bounds;

self.loadingPageView.backgroundColor = [UIColor darkGrayColor];

[self.view addSubview:loadingPageView];

After I run, I get the following display

Image of empty table view on iPad simulator

Is there a way to hide the table view completely from the display after adding the UIView as the subview?

Upvotes: 0

Views: 692

Answers (1)

dasdom
dasdom

Reputation: 14063

I am not sure if you can add something to the view of a tableViewController. I would add both the tableViewController.tableView and the loadingPageView to one superview.

Upvotes: 1

Related Questions