IPhone - After dismissing Modal View Controller - gap is left at top of page

后端 未结 16 967
暖寄归人
暖寄归人 2020-12-24 07:07

When starting the app, if the user doesn\'t have login information stored, I want to display a modal view controller to force the entry of this information. I found through

16条回答
  •  时光取名叫无心
    2020-12-24 07:58

    I had the same problem. My solution was to temporarily close the status bar just before switching views:

    - (void) temporarilyHideStatusBar {
      [[UIApplication sharedApplication] setStatusBarHidden:YES];
      [self performSelector:@selector(showStatusBar) withObject:nil afterDelay:0];
    }
    - (void) showStatusBar {
      [[UIApplication sharedApplication] setStatusBarHidden:NO];
    }
    
    // Use these by calling the hide function just before a broken view switch:
    [self temporarilyHideStatusBar];
    [self doViewSwitch];
    
    // No need to call [self showStatusBar]; explicitly.
    

    I experimented with other code-based solutions, and I like this one the best because it works 100% of the time - some of my frame-based solutions only worked most of the time - and because it has minimal user-visible effects.

    I suspect this is an Apple bug, and it would be nice to hear the official word from them on the best workaround.

提交回复
热议问题