开发者

View shifts under status bar when not expected - then corrects itself

开发者 https://www.devze.com 2023-01-27 22:54 出处:网络
I have a view controller that flips in to provide basic app info. When this view initially loads, it slides under the status bar, shifting the entire view up 20 pixels. The xib file is built with the

I have a view controller that flips in to provide basic app info. When this view initially loads, it slides under the status bar, shifting the entire view up 20 pixels. The xib file is built with the status bar in place - but the view is shifter up, and has 20 blank pixels at the bottom.

But if I transition back to the main part of the app, and the go to this view again later, the view shifts down 20 pixels, and then looks as it should - even though I've taken no action that would cause the view to shift. The code below may not shed any light on this issue - but any idea what's going on here?

if (self.infoViewController == nil) {
        infoViewController = 
        [[InfoViewController alloc ] initWithNibName:@"InfoViewController" bundle:nil];
    }

    [UIView transitionFromView:self.view toView:infoViewController.view duration:1.0 opt开发者_如何学Cions:UIViewAnimationOptionTransitionFlipFromLeft completion:nil];


In this context, I think you may have written code for hiding the status bar in the infoViewController. Or else while creating the infoViewController nib file, unexpectedly you may set the statausbar to None.

View shifts under status bar when not expected - then corrects itself

Change the status bar value.

View shifts under status bar when not expected - then corrects itself

So once check those, your problem will be solved.

0

精彩评论

暂无评论...
验证码 换一张
取 消