0

I'm using AirPlay, the primary content of the iPad is beamed to the AppleTV fine.

When I want different information on the iPad than is on the AppleTV, I'm getting resolution issues.

I instantiate the UIWindow:

_atvWindow = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 2048, 1536)];

NSLog indicates the window is the frame size I want

I set the UIWindow to the iPad screen

_atvWindow.screen = [[UIScreen screens] objectAtIndex:0];

NSLog indicates the window frame is now 1024x768

It's a retina iPad. I want the size to remain retina and the set images accordingly. Once I add retina quality images they are (as you'd expect) way too big. Any ideas what's causing this or what I am missing here?

chillok
  • 235
  • 1
  • 3
  • 11

1 Answers1

0

Have you tried to read the frame size from the screen which comes in your [notification object] object?

- (void)handleConnectedScreen:(UIScreen *)screen withViewController:(UIViewController *)controller {
    if(!_airPlayWindow)
    {
        CGRect frame = screen.bounds;
        _airPlayWindow = [[UIWindow alloc] initWithFrame:frame];
        _airPlayWindow.backgroundColor = [UIColor clearColor];
        [_airPlayWindow setScreen:screen];
        _airPlayWindow.hidden = NO;
    }

    UIViewController *oldController = _airPlayWindow.rootViewController;
    [_airPlayWindow setRootViewController:controller];
    [oldController removeFromParentViewController];
}


- (void)screenDidConnect:(NSNotification *)notification {
    ABOutputViewController *c = [[ABOutputViewController alloc] init];
    [self handleConnectedScreen:[notification object] withViewController:c];
}


[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(screenDidConnect:) name:UIScreenDidConnectNotification object:nil];
Ondrej Rafaj
  • 4,342
  • 8
  • 42
  • 65