Question

I have a View Controller, called TVOutViewController (.h & .m) which should handle my external Screen. How can I "tell" the View Controller to do so?

What I did already:

NSLog(@"Current Number of screens: %i", [[UIScreen screens] count]);


if([[UIScreen screens]count] > 1) {

    CGSize maxSize;
    UIScreenMode *maxScreenMode;

    for(int i = 0; i < [[[[UIScreen screens] objectAtIndex:1] availableModes]count]; i++)
    {
        UIScreenMode *current = [[[[UIScreen screens]objectAtIndex:1]availableModes]objectAtIndex:i];
        if(current.size.width > maxSize.width)
        {
            maxSize = current.size;
            maxScreenMode = current;
        }
    }
    UIScreen *externalScreen = [[UIScreen screens] objectAtIndex:1];
    externalScreen.currentMode = maxScreenMode;

So there is an external Screen in my array now (and recognized). But how can I add (for example) a label to this screen?

Is there a way like:

 Screen Handled by the TVOutViewController = TheExternalScreen //Pseudocode
 [Screen Handled by the TVOutViewController addSubview: aLabel]; //Pseudocode

Thank you!

Was it helpful?

Solution

Got it. The UIWindow has to be defined GLOBALLY!

OTHER TIPS

Check out this sample code: https://github.com/quellish/AirplayDemo

That does pretty much what you're looking for.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top