Why are views loaded from nibs placed 20 pixels down from the status bar?

I am trying to customize the layout as such in an iPad application. It will have three main types that make up the entire screen. Views will be stacked on top of each other, each of which will occupy the entire width. I have one main nib file that takes into account the whole screen. In this nib file, I create three view controllers with outputs. 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 views above each other and 20 pixels below. However, after turning to the landscape and back, they are under the status bar. Do you know what could cause this?

+3
source share
1 answer

I understood the reason for this. When you edit View Controller in Interface Builder, I need to uncheck "Resize image from Nib". Then he goes into the frame that I set and stay in the right place.

+5
source

Source: https://habr.com/ru/post/1739369/


All Articles