ViewController leaves 20px white from the bottom of the screen when pressed

I use several controllers while running the application in the application delegate. One controller is for registration, and the second controller is the panel. The tabbar loaded fine, but when I clicked the registration controller on the window, the content increased by 20 units and I have a nice white blank screen at the bottom. So I recreated the frame of my view registration controller in my viewdidload method and moved it down 20 units. The code

self.view.frame = CGRectMake(0, 20, self.view.frame.size.width, self.view.frame.size.height);

and the code in my application for launch was

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    if (![self accountExists]) {
                //code if account does not exists on iphone app database
        self.registerAccount = [[registerViewController alloc] initWithNibName:@"registerViewController" bundle:nil];
        [window addSubview:registerAccount.view];
    }
    else if([self autoLoginForAnyAccount]){
        //code for autologin to app
    }
    else {
        self.tabBarController.selectedIndex = 1;
        self.tabBarController.delegate = self;
        [window addSubview:tabBarController.view];
    }
    [window makeKeyAndVisible];
    return YES;
}

if anyone knows why there is a bottom empty space when the registration controller is pressed, please share it with me.

+3
2

, . , registerViewController, ( , ). registerViewController , - ( , ) , 20px registerViewController . registerAccount.view.frame = window.frame;, . , 20px , , . , , , .

, UIViewcontroller mainWindow.xib( ), registerViewController nib registerViewController. self.registerAccount = [[registerViewController alloc] initWithNibName:@"registerViewController" bundle:nil];

.h registerViewController *registerAccount; UIViewController *registerAccount;, mainWindow.xib . , , viewcontroller , registerViewController. - , , , .

+1

. Q & A , .

, ...

[self.view setFrame:CGRectMake(0,0, self.view.bounds.size.width, self.view.bounds.size.height)]; 

, .

, iApple.

+3

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


All Articles