外接显示器的窗口会影响主屏幕 [英] Window for an External Display affects primary screen

查看:101
本文介绍了外接显示器的窗口会影响主屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当有其他屏幕(最多2个)时,我将创建一个新窗口.每个窗口在不同的屏幕上显示不同的内容.

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

问题出在iOS7下:创建并显示此外部窗口使状态栏在第一个窗口(也是主要窗口)中可见.然后,系统增加一些空间(20个点)以重新排列顶部栏和一些视图.它对我不起作用,因为它是自定义栏.

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?

这是令人反感的代码:

- (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;
        }
}

我尝试将_secondWindow的框架更改为较小的区域.无法解决问题.

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

要处理状态栏,应按以下方式配置应用程序在应用程序属性列表下:基于视图控制器的状态栏外观= YES
我为不想显示状态栏的每个视图添加了此代码:

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;
}

推荐答案

由于您提到了基于视图控制器的状态栏外观"-也请尝试将状态栏最初处于隐藏状态"设置为true.

Because you mentioned the "View controller-based status bar appearance" - also try setting the "Status bar is initially hidden" to true.

<key>UIStatusBarHidden</key>
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>

这篇关于外接显示器的窗口会影响主屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆