I'm trying to keep my code clean and keep the number of files down. I am using a UITableViewController and I would like to load another view on top of it. I thought this would be pretty simple:
(1) create an IBOutlet in my .h file
@interface MyViewController : UITableViewController {
...
UIView *downloadView;
...
}
...
@property (nonatomic, retain) IBOutlet UIView *downloadView;
...
(2) link it to my view in IB
(3) do something like:
self.view = downloadView;
or
[self.view addSubview:self.downloadView];
But that doesn't work for me. If I do
[self.tableView removeFromSuperview];
Then the table view goes away but I don't know how to add my view from my nib. I'm doing everything for tableView programatically but I didn't think that would matter. And with UITableViewController subclassing UIViewController I thought it would be no problem using addSubview or something like that. What am I missing? This shouldn't be that hard right?
Update: So if I do the following:
UIView *newView = [[UIView alloc] initWithFrame:self.view.frame];
newView.backgroundColor = [UIColor greenColor];
[self.view addSubview:newView];
It does (mostly) what I want. So does this mean I'm messing something up with the way I'm connecting my view from IB? In IB I set the fileOwner's class to MyViewController and I make a connection between downloadView and the view that I created (in IB). That's all I should have to do right?