I've created an iPad app which contains a slideshow and when this slideshow is tapped by the user he/she can entered some information.
What I'd like to do now is to display the slideshow contents on a TV when connecting the TV and iPad through AirPlay (or cable if possible, but that only seems to mirror things)
Can this be done? Can we have the slideshow run on the TV and also on iPad and then when the user taps the slideshow on the iPad the credentials input screen will show but on TV still the underlying slideshow will show and not the credentials?
How can this be done in iOS? Is it possible to display a portion of the application on the TV? So not mirroring the entire application.
You can write the app to handle 2 UIScreens using Airplay and an Apple TV then set a seperate root view controller for both the TV UIScreen and for the iPad UIScreen. Then display the image or slideshow on the TV's view controller and run that from the events of you iPads view controller!
AMENDED AFTER CLIFS COMMENT:
So firstly in your app delegate in didFinishLaunchingWithOptions or didFinishLaunching setup a notification to receive the screen did connect.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(screenDidConnect:) name:UIScreenDidConnectNotification object:nil];
Then you need to keep a reference to your separate window and push controllers to it as you would 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]];
}