Aaleks
Aaleks

Reputation: 4343

How to make 16:9 pdf to fit to screen size in vfr/Reader on second screen 16:9 airplay from iPad 4:3

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?

Upvotes: 1

Views: 641

Answers (1)

Anders Cedronius
Anders Cedronius

Reputation: 2076

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

Upvotes: 0

Related Questions