Black bars with HDMI Adapter on iPad 2

后端 未结 3 986
生来不讨喜
生来不讨喜 2021-02-11 02:16

My app supports HDMI Output.

I asked the code for the resolution of the TV and got 1920 x 1080 px for

externalScreen.bounds

OK, everyth

相关标签:
3条回答
  • 2021-02-11 02:24
    externalScreen.overscanCompensation = UIScreenOverscanCompensationInsetApplicationFrame;
    
    0 讨论(0)
  • 2021-02-11 02:37

    The home screen will have black bars because the aspect ratio doesn't match 16:9 (it's 4:3 I think). As far as the external display, check the frame of your main view (the view that's supposed to span the screen). It is probably not set to 1920 x 1080

    edit: I used this code for a project where I had to output from an iPad to a 1920 x 1080 display and it worked

    - (void) screenDidConnect:(NSNotification *)aNotification
    {
        NSLog(@"A new screen got connected: %@", [aNotification object]);
        //[self printScreenInfo];
    
        UIScreen* newScreen = [aNotification object];
    
        CGRect screenBounds = newScreen.bounds;
    
        if (!self.externalWindow)
        {
            self.externalWindow = [[UIWindow alloc] initWithFrame:screenBounds];
    
            self.externalWindow.screen = newScreen;
            self.externalViewController.view.frame = externalWindow.frame;
    
            [self.externalWindow addSubview:externalViewController.view];
    
            self.externalWindow.hidden = NO;
            // Set the initial UI for the window.
            // [externalViewController displaySelectionInSecondaryWindow:externalWindow];
    
        }
    }
    
    0 讨论(0)
  • 2021-02-11 02:45

    The setting that works best for most TVs is:

    externalScreen.overscanCompensation = UIScreenOverscanCompensationInsetBounds | UIScreenOverscanCompensationInsetApplicationFrame; // this is the same as setting it to 3
    

    Just setting it to UIScreenOverscanCompensationInsetApplicationFrame can cause misalignment of the UIWindow contents.

    0 讨论(0)
提交回复
热议问题