2

外部ディスプレイに全画面表示したいだけです。

私は次のようなコードを使用しています:

- (void) startTvOut {
    NSArray *screens = [UIScreen screens];

    CGSize max;
    max.width = 0;
    max.height = 0;
    UIScreenMode *maxScreenMode = nil;
    for (UIScreen *screen in screens)
    {

        if (screen != [UIScreen mainScreen])
        {
            for(int i = 0; i < [[screen availableModes] count]; i++)
            {
                UIScreenMode *current = [[screen availableModes] objectAtIndex: i];
                if (current.size.width > max.width)
                {
                    max = current.size;
                    maxScreenMode = current;
                }
            }
            if (exWindow == nil)
            {
                exWindow = [[HUWindow alloc] initWithFrame:screen.brounds];
                exWindow.backgroundColor = [UIColor whiteColor];
            }
            screen.overscanCompensation = UIScreenOverscanCompensationInsetBounds;
            screen.currentMode = screen.preferredMode;
            exWindow.screen = screen;

            [exWindow makeKeyAndVisible];
            m_isStarted = YES;
        }
    }
}

外部デバイスでは全画面表示できません。

コードを から に変更する screen.overscanCompensation = UIScreenOverscanCompensationInsetBounds;screen.overscanCompensation = UIScreenOverscanCompensationInsetApplicationFrame; 、全画面表示できますが、ポイント (0,0) が左画面の上部にありません。

私の目標は、画面を全画面表示し、画面の左上隅にポイント (0, 0) を表示することです。しかし、うまくいきません。

前もって感謝します

4

2 に答える 2

6

この行を変更します。

screen.overscanCompensation = UIScreenOverscanCompensationInsetBounds;

screen.overscanCompensation = 3;

それは文書化されていない値です...

于 2012-11-17T18:07:30.233 に答える
0

私にとっては、次のコードで問題が解決しました(XCode 4、iOS 12.1)

screen.overscanCompensation = .scale

この行を追加する前に、黒いフレームが画面の周りにあるという問題がありました。

于 2019-06-27T21:04:52.403 に答える