Black bars with HDMI Adapter on iPad 2

后端 未结 3 992
生来不讨喜
生来不讨喜 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: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];
    
        }
    }
    

提交回复
热议问题