IOS that works on two screens (no mirroring)

I created an iPad application that contains a slide show, and when this slide show is used by the user, he can enter some information.

Now I would like to show the contents of the slide show on the TV when I connect the TV and iPad via AirPlay (or, if possible, a cable, but it only seems to be mirrored)

Can this be done? Can we launch the slideshow on the TV, as well as on the iPad, and then when the user closes the slideshow on the iPad, the credentials entry screen will show, but the main slideshow is shown on the TV, not the credentials?

How can this be done in iOS? Can I display part of the application on a TV? So do not mirror the entire application.

+6
source share
2 answers

You can write an application to handle 2 UIS screens using Airplay and Apple TV, and then install a separate root view controller for both UIScreen TV and iPad UIScreen. Then show the image or slideshow on the TV view controller and start it from the events of your iPad controller!

AMENDMENT AFTER COMMENT CLIFS:

So, firstly, in your application deletion in the didFinishLaunchingWithOptions or didFinishLaunching file, the notification about receiving the screen really connected.

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(screenDidConnect:) name:UIScreenDidConnectNotification object:nil]; 

Then you need to save the link to your separate window and click on the controllers on it, as in any other window.

 - (void) myScreenInit:(UIScreen *)connectedScreen:(UIViewController*)mynewViewController { //Intitialise TV Screen if(!windowTV) { CGRect frame = connectedScreen.bounds; windowTV = [[UIWindow alloc] initWithFrame:frame]; windowTV.backgroundColor = [UIColor clearColor]; [windowTV setScreen:connectedScreen]; windowTV.hidden = NO; } UIViewController* release = windowTV.rootViewController; windowTV.rootViewController = mynewViewController; [release removeFromParentViewController]; [release release]; } - (void)setTvController:(UIViewController*)mynewViewController { UIViewController* release = windowTV.rootViewController; windowTV.rootViewController = mynewViewController; [release removeFromParentViewController]; [release release]; } - (void)screenDidConnect:(NSNotification *)notification { [self myScreenInit:[notification object]]; } 
+18
source

There is a bug in iOS 5.0 that makes this difficult. You have to enable mirroring from the taskbar (scrolling all the way to the left until the second screen is detected through the API. I posted the details in my question here: How to use iOS 5+ AirPlay for the second screen

0
source

Source: https://habr.com/ru/post/900573/


All Articles