0

I create a new window when there is an additional screen (up to 2). Each window shows a different content, in a different screen.

The problem is under iOS7: Creating and showing this external window makes the status bar visible in the first one, which is also the main one. Then, the system adds some space (20points) to rearrange the top bar and some views. It does not work for me, because it's a custom bar.

Why is this happening and how may I stop the system to add the status bar?

This is the offending code:

- (void) handleScreenConnectNotification:(NSNotification*)notification
{
        NSLog(@"screens=%@ _secondWindow = %@",[UIScreen screens], _secondWindow );
        if ( [[UIScreen screens] count] > 1) {
            // Associate the window with the second screen.
            // The main screen is always at index 0.
            UIScreen * secondScreen = [[UIScreen screens] objectAtIndex:1];
            CGRect screenBounds = secondScreen.bounds;

            _secondWindow = [[UIWindow alloc] initWithFrame:screenBounds];
            _secondWindow.screen = secondScreen;

            _secondWindow.hidden = NO;
        }
}

I have tried changing the _secondWindow's frame to a smaller area. Does not solve the issue.

To handle the status bar, the app is configured like this Under the app property list: View controller-based status bar appearance = YES
I added this code for each view I do not want to show the status bar:

- (BOOL)prefersStatusBarHidden
{
    return YES;
}
4

2 回答 2

1

因为您提到了“查看基于控制器的状态栏外观” - 也尝试将“状态栏最初隐藏”设置为 true。

<key>UIStatusBarHidden</key>
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
于 2013-11-01T21:22:43.100 回答
0

要正确处理您不希望最初隐藏状态栏的情况,请为您的第二个窗口提供一个 rootViewController。这个 rootViewController 必须实现 -(BOOL)prefersStatusBarHidden。

于 2013-11-16T23:27:09.647 回答