ios - iPad airplay display shows black screen when I create a new UIWindow -


[edit] restarted ipad , fixed issue. i'm leaving here because stack overflow discouraged deleting question

i have weird thing happening on ipad air 2. using method mentioned in https://developer.apple.com/library/ios/documentation/windowsviews/conceptual/windowandscreenguide/usingexternaldisplay/usingexternaldisplay.html

i create new uiwindow object secondary display connected through airplay.

- (void)checkforexistingscreenandinitializeifpresent {    if ([[uiscreen screens] count] > 1)    {     // screen object represents external display.     uiscreen *secondscreen = [[uiscreen screens] objectatindex:1];     // screen's bounds can create window of correct size.     cgrect screenbounds = secondscreen.bounds;      self.secondwindow = [[uiwindow alloc] initwithframe:screenbounds];     self.secondwindow.screen = secondscreen;      nslog(@"show external window");     // set initial content display...     uistoryboard *storyboard = [uistoryboard storyboardwithname:@"test" bundle:[nsbundle mainbundle]];     uiviewcontroller *controller = [storyboard instantiateinitialviewcontroller];     self.secondwindow.rootviewcontroller = controller;     // show window.     self.secondwindow.hidden = no;    } 

}

when run code on iphone 5s, code works , secondary window initialized. however, when run code xcode on ipad air 2, see black screen. if app not run through xcode, app launches on ipad on airplay display shows home screen app icon highlighted. audio still routed through airplay.

any appreciated.

normally change our uiwindow color this:

[uiapplication sharedapplication].keywindow.backgroundcolor = [uicolor mycolor]; 

you can set self.secondwindow color as:

secondwindow.backgroundcolor = [uicolor whitecolor]; 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -