我想重现我的iPhone显示器用于演示目的。我试过了 this和this,但都给了我一个黑屏。最后,我走出去制定自己的解决方案。这就是我所拥有的:
// Check for external screen.
if ([[UIScreen screens] count] > 1) {
externalWindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Internal display is 0, external is 1.
externalScreen = [[[UIScreen screens] objectAtIndex:1] retain];
screenModes = [externalScreen.availableModes retain];
UIScreenMode *desiredMode = [screenModes objectAtIndex:0];
externalScreen.currentMode = desiredMode;
externalWindow.screen = externalScreen;
[screenModes release];
[externalScreen release];
CGRect rect = CGRectZero;
rect.size = desiredMode.size;
externalWindow.frame = rect;
externalWindow.clipsToBounds = YES;
externalWindow.hidden = NO;
[externalWindow makeKeyAndVisible];
[externalWindow setUserInteractionEnabled:YES];
[externalWindow setMultipleTouchEnabled:YES];
//[[CCDirector sharedDirector] attachInView:externalWindow];
现在,我可以在外部显示器或我的iPhone上显示,但我无法同时在两者上显示,因为[[CCDirector sharedDirector] attachInView:externalWindow];只需要一个UIWindow。如何解决此问题和/或获取显示的图像并将其设置为外部显示器?
谢谢,
戴夫
答案 0 :(得分:1)
我看到的唯一解决方案是将场景渲染为纹理并将该纹理渲染两次作为后挡板的全屏四边形,每个UIWindow一次