ios - Present a view controller on different UIWindow -
i need solving problem i've been having 2 whole days. let had custom view controller handles image slideshows , can used embed on view or present via navigation controller or modal view. has full screen options can turned on using code
_fullscreenwindow = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; _fullscreenwindow.backgroundcolor = [uicolor blackcolor]; _fullscreenwindow.windowlevel = uiwindowlevelnormal; _fullscreenwindow.rootviewcontroller = self; [_fullscreenwindow makekeyandvisible];
i stored original window beforehand can restore state when exiting full screen. calls orientation methods, not called when in navigation controller. while in full screen mode state, there option can presented uitableviewcontroller in theory can present using code.
uitableviewcontroller *mediaoptionscontroller = [[uitableviewcontroller alloc] initwithstyle:uitableviewstylegrouped]; uinavigationcontroller *navcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:mediaoptionscontroller]; [navcontroller setmodalpresentationstyle:uimodalpresentationformsheet]; navcontroller.navigationbar.topitem.leftbarbuttonitem = dismissbutton; //mainviewcontroller custom view controller, on different uiwindow [mainviewcontroller presentviewcontroller:navcontroller animated:yes completion:nil];
but got warning whenever use option , unable present it
warning: attempt present uinavigationcontroller on uinavigationcontroller view not in window hierarchy!
any idea why not working? know setting root controller on app delegate not viable since went directly root controller's view instead of current top view of navigation controller
not solution resolved issue dismissing 2nd window , make main window key, , present options there. exiting options make 2nd window key again.
Comments
Post a Comment