Black bars with HDMI Adapter on iPad 2

三世轮回 提交于 2019-12-03 09:43:13

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

    }
}
externalScreen.overscanCompensation = UIScreenOverscanCompensationInsetApplicationFrame;

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!