Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/105.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 当我创建一个新窗口时,iPad airplay显示屏显示黑色屏幕_Ios_Iphone_Ipad_Airplay_Mirroring - Fatal编程技术网

Ios 当我创建一个新窗口时,iPad airplay显示屏显示黑色屏幕

Ios 当我创建一个新窗口时,iPad airplay显示屏显示黑色屏幕,ios,iphone,ipad,airplay,mirroring,Ios,Iphone,Ipad,Airplay,Mirroring,[编辑] 我重启了iPad,它解决了这个问题。我把它留在这里是因为堆栈溢出不鼓励删除这个问题 我在iPad Air 2上遇到了一件奇怪的事情。使用中提到的方法 我为通过AirPlay连接的辅助显示器创建了一个新的UIWindow对象 - (void)checkForExistingScreenAndInitializeIfPresent { if ([[UIScreen screens] count] > 1) { // Get the screen object th

[编辑] 我重启了iPad,它解决了这个问题。我把它留在这里是因为堆栈溢出不鼓励删除这个问题

我在iPad Air 2上遇到了一件奇怪的事情。使用中提到的方法

我为通过AirPlay连接的辅助显示器创建了一个新的
UIWindow
对象

- (void)checkForExistingScreenAndInitializeIfPresent {
   if ([[UIScreen screens] count] > 1)
   {
    // Get the screen object that represents the external display.
    UIScreen *secondScreen = [[UIScreen screens] objectAtIndex:1];
    // Get the screen's bounds so that you can create a window of the correct size.
    CGRect screenBounds = secondScreen.bounds;

    self.secondWindow = [[UIWindow alloc] initWithFrame:screenBounds];
    self.secondWindow.screen = secondScreen;

    NSLog(@"Show external window");
    // Set up initial content to display...
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Test" bundle:[NSBundle mainBundle]];
    UIViewController *controller = [storyboard instantiateInitialViewController];
    self.secondWindow.rootViewController = controller;
    // Show the window.
    self.secondWindow.hidden = NO;
   }
}

当我在iphone5s上运行此代码时,代码工作正常,辅助窗口已初始化。然而,当我在iPad Air 2上从Xcode运行此代码时,我只看到一个黑屏。如果应用程序不是通过Xcode运行,则应用程序会在iPad上启动,但在AirPlay显示屏上,它只会显示主屏幕,并突出显示应用程序图标。音频仍然通过AirPlay传送


任何帮助都将不胜感激。

通常我们会这样更改窗口颜色:

[UIApplication sharedApplication].keyWindow.backgroundColor = [UIColor myColor];
您可以将self.Second窗口颜色设置为:

secondWindow.backgroundColor = [UIColor whiteColor];

这是一个荒谬的案例,解决方案也同样荒谬。我重新启动了iPad,问题就消失了。

这里有一个疯狂的猜测,但故事板中是否有您试图加载的“仅限iPhone”的内容?这可以解释为什么iPad上不会显示它。@Ermiar你不会相信的。在数小时的思考之后,我重新启动了iPad。奇迹般地,它成功了!哈哈,好吧!在这种情况下,我不知道你是否需要自己回答这个问题,或者干脆把它关闭。无论如何,很高兴你找到了解决方案。@Ermiar我试图删除它,但我似乎找不到选项。你的帖子旁边没有“删除”按钮吗?我在iPad 2中也面临同样的问题。在我的情况下,有时它经常发生。你找到任何理由或更好的解决方案了吗?不,我很抱歉@Deepak它只发生在我身上一次,在它消失后再也没有回来。谢谢@Matt,对不起,我的设备不是iPad 2,而是iPad 3,3。设备信息-:型号-:iPad Wi-Fi+4G(LTE/GSM)-iPad3,3 iOS-:9.3.1(13E238)