cocoa touch - Second UIWindow Not Displaying (iPad) -


i attempting create 2 uiwindows because 2 uinavigationcontrollers on screen @ same time on app. initialize 2 windows in app delegate 1 window's view displayed. know why so?

here code used:

- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {          uiviewcontroller * controller1 = [[uiviewcontroller alloc] init];     [controller1.view setbackgroundcolor:[uicolor graycolor]];     uinavigationcontroller * nav1 = [[uinavigationcontroller alloc] initwithrootviewcontroller:controller1];     [window addsubview:nav1.view];     [window makekeyandvisible];      uiwindow * window2 = [[uiwindow alloc] initwithframe:cgrectmake(0, 0, 100, 100)];     uiviewcontroller * controller2 = [[uiviewcontroller alloc] init];     [controller2.view setbackgroundcolor:[uicolor yellowcolor]];     uinavigationcontroller * nav2 = [[uinavigationcontroller alloc] initwithrootviewcontroller:controller2];     [window2 addsubview:nav2.view];     [window2 makekeyandvisible];       nslog(@"%@", [[uiapplication sharedapplication] windows]);        return yes; 

}

the gray first window visible, yellow second not. output is:

"<uiwindow: 0x591e650; frame = (0 0; 768 1024); opaque = no; autoresize = rm+bm; layer = <calayer: 0x591e7a0>>", "<uiwindow: 0x5923920; frame = (0 0; 100 100); layer = <calayer: 0x59239a0>>"

which means second window created , added application, not displayed. know why so?

thanks in advance!

the 2 uiwindow's windowlevel property equal, uiwindowlevelnormal. if want second uiwindow display font of first uiwindow, should set second uiwindow's windowlevel value bigger. like:

window2.windowlevel = uiwindowlevelnormal + 1; 

ps:

[window makekeyandvisible];   ...   [window2 makekeyandvisible]; 

there 1 keywindow @ time, key window 1 designated receive keyboard , other non-touch related events. 1 window @ time may key window.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -