1

I would like to display on the AirPlay screen the same content as the mainScreen like It does by default when you connect your device to AirPlay within the app. This is OK work naturally.

But my second screen is 16:9 and my iPad 4:3 and I use vfr/Reader and the pdf I read is in 16:9 What I want to achieve is like like PowerPoint when you launch a .pptx in slideshow mode. it show the pptx only in 16:9 on the second screen.

What i have tried is this : https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/WindowAndScreenGuide/UsingExternalDisplay/UsingExternalDisplay.html#//apple_ref/doc/uid/TP40012555-CH3-SW1

What i can achieve is to have the second screen bigger full width with red background :

   if (_secondWindow)
    {
        NSLog(@"INIT SECOND WINDOW");
        _secondWindow = [[UIWindow alloc] initWithFrame:screenBounds];
        _secondWindow.backgroundColor = [UIColor redColor];

        _secondWindow.screen = newScreen;
        _secondWindow.hidden = NO;

        //change size to 200 200 
        //_secondWindow.frame = CGRectMake(0, 0, 200,200);

        // Set the initial UI for the window.

    }

What i need is to say something like take the content of my main current widow and replicate it to the _secondWindow with different size bigger.

When i do this :

_secondWindow = [[[UIApplication sharedApplication] delegate] window];

I have the mainWindow content on the second screen but the size doesn't change. I only need to force the size of the mirroring screen, scale my content on the mirroring screen. and keep them sync

Is there a way to achieve this ? I see on some post that it is impossible to have the same instance for the two screens, is there maybe a better way than using the vfr/Reader something like have the reader in two webView or something else ? Or the maximum that can be done in this situation is only replicate the current pdf as png (but keep high resolution quality) on the second screen ?

But how it works when you have video in your app, you need to handle each cases?

Aaleks
  • 4,283
  • 5
  • 31
  • 39

1 Answers1

0

You need to create a whole new display using:

- (void)handleScreenDidDisconnectNotification:(NSNotification*)aNotification

and

- (void)handleScreenDidConnectNotification:(NSNotification*)aNotification

Then when you got that screen you can utilise the full resolution.

In order to utilise the full with and height of the second screen (no borders) you need to:

secondScreen.overscanCompensation=UIScreenOverscanCompensationNone;

Where 'secondScreen' is the AirPlay: (UIScreen).

Observe that UIScreenOverscanCompensationNone was introduced in IOS 9, setting the overscanCompensation to 3 also works with older IOS versions however compatibility issues are unknown to me as I only target IOS 9 or later.

/Anders

Anders Cedronius
  • 2,036
  • 1
  • 23
  • 29
  • I tried to add secondScreen.overscanCompensation=UIScreenOverscanCompensationNone; after // Get the screen object that represents the external display. UIScreen *secondScreen = [[UIScreen screens] objectAtIndex:1]; // Get the screen's bounds so that you can create a window of the correct size. CGRect screenBounds = secondScreen.bounds; But it does not work same size as the default size when first activate the mirroring – Aaleks Mar 09 '16 at 15:55
  • I tried every option but nothing change. UIScreen *secondScreen = [[UIScreen screens] objectAtIndex:1]; secondScreen.overscanCompensation=UIScreenOverscanCompensationInsetApplicationFrame; no differences – Aaleks Mar 09 '16 at 15:58
  • I really want to achieve the same thing as in Powerpoint when you have a 16:9 powerpoint and when you launch the slideshow mode the presentation on the second screen scale to be larger – Aaleks Mar 09 '16 at 16:00
  • When i create a _secondWindow setting the second screen bounds and show the _secondWindow and set background color to red It fill all the airplay second screen... So it seem that my UIWindow is blocking something... – Aaleks Mar 09 '16 at 16:03
  • 1
    Ok. sounds like you should use: CATransform3DMakeScale to compensate for the aspect difference. Are you familiar with: CATransform3DMakeScale? – Anders Cedronius Mar 09 '16 at 16:05