Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Black bars with HDMI Adapter on iPad 2

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, everything fine. I've setup my views and tried it on the TV ...

BUT: There were black bars on the bottom / top / sides of the screen though the TV was detected correctly as 1920 x 1080 and my view is also set up correctly?

Why is the format wrong?

P.S. When I mirror the home screen, it also shows the bars, when I watch a video with the Youtube App, the black bars disappear?

Thank you for your help!

Update:

OK, although I got this output in my console:

A new screen got connected: <UIScreen: 0x3439a0; bounds = {{0, 0}, {1920, 1080}}; mode = <UIScreenMode: 0x345240; size = 1920.000000 x 1080.000000>>

... I still get the black frame. I init my view with CGRectMake(0.0f,0.0f,1920.0f,1080.0f) for test purposes.

This is the view I can see on my screen (note the black bars):

enter image description here

like image 968
DAS Avatar asked Dec 31 '25 22:12

DAS


2 Answers

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

    }
}
like image 168
Dima Avatar answered Jan 03 '26 14:01

Dima


externalScreen.overscanCompensation = UIScreenOverscanCompensationInsetApplicationFrame;
like image 41
DAS Avatar answered Jan 03 '26 12:01

DAS



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!