How to hide UIStatusBar in relation to displayed UIViews?

I have an application that focuses mainly on the navigation bar. In several cases, a modal view is required, and one of these cases requires hiding the status bar. However, even if I hide the status bar before the modal view, the view is shifted by 20 pixels.

Even if I set the modal view frame to 0, -20,320,480 after the appearance of the view, it will disable the top of the view.

I also want the user to be able to show the status bar (and toolbar) when clicking on the screen, how the video player works. Therefore, I set the color black for this screen to be transparent, and I hope that hiding or showing the status bar will not lead to a transition up and down.

+3
source share
2 answers

Seeing from your comment below that you are targeting iPhone OS 2.x, I have a suggestion that might help.

Before introducing your modal view, do the following:

  [[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES];
  [[self view] setFrame:CGRectMake(0, 0, 320, 480)];

, 480 - 20px . , - , - 460 ( ), , .

:

[[UIApplication sharedApplication] setStatusBarHidden:NO animated:YES];
[[self view] setFrame:CGRectMake(0, 20, 320, 460)];

, presentModalViewController - , -addSubview, . (.. ).

+2

wantsFullScreenLayout UIViewControllers?

+2

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


All Articles