Question

I read about displaying another view on an external screen (and that this disables mirroring) in Apple's documentation on Presenting Content on an External Display. But it seems that when a second window is set to be for a screen there's no way to get the screen back to mirroring the first one.

There is a property called mirroredScreen on the UIScreen object that is described as containing the mirrored screen if the device is able to mirror and mirroring is still active. It goes nil when another window is associated with the UIScreen. But it's a read-only property and there's no other way to set it back up for mirroring :(

Was it helpful?

Solution

I had exactly the same, resulting in a black screen without resetting back. For me the combination of the following code did the trick. First, reset the secondWindow, second, reassign your main screen to make it work with touches again.

// Reset the second window
self.secondWindow.frame = CGRectZero;
self.secondWindow.screen = nil;
self.secondWindow = nil;

// Reassign your main screen to make it work with touches again
UIWindow *mainScreen = [[[UIApplication sharedApplication] windows] firstObject];
[mainScreen makeKeyAndVisible];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top