Why are Views loaded from nibs being placed 20 pixels down from the status bar?
I am trying to set up a layout as such in an iPad application. It will have three major views, which make up the whole screen. The views wil开发者_如何学Pythonl be stacked one on top of the other, each taking up the full width. I have one major nib file which accounts for the entire screen space. In that nib file, I am instantiating the three view controllers with outlets. Then I have this code:
- (void)viewDidLoad {
[super viewDidLoad];
[self.view addSubview:controllerOne.view];
[self.view addSubview:controllerTwo.view];
[self.view addSubview:controllerThree.view];
}
This adds the views on top of one another and 20 pixels lower. However, after rotating to landscape and back they are right under the status bar. Do you know what would be causing this?
I figured out the cause of this. When you are editing the View Controller in Interface Builder, I needed to uncheck "Resize View from Nib." Then it comes in at the frame I set and stays in the right place.
精彩评论