ios - Switch between two UIWindow's -
i integrating pushwoosh sdk push notification, using uiwindow
represent html page sent pushwoosh portal
- (void) showwebview { self.richpushwindow.alpha = 0.0f; self.richpushwindow.windowlevel = uiwindowlevelstatusbar + 1.0f; self.richpushwindow.hidden = no; self.richpushwindow.transform = cgaffinetransformmakescale(0.01, 0.01); [uiview animatewithduration:0.3 animations:^{ self.richpushwindow.transform = cgaffinetransformidentity; self.richpushwindow.alpha = 1.0f; } completion:^(bool finished) { }]; } - (void) showpushpage:(nsstring *)pageid { nsstring *url = [nsstring stringwithformat:kservicehtmlcontentformaturl, pageid]; htmlwebviewcontroller *vc = [[htmlwebviewcontroller alloc] initwithurlstring:url]; vc.delegate = self; vc.supportedorientations = supportedorientations; self.richpushwindow.rootviewcontroller = vc; [vc view]; }
and on closing on html page calls
self.richpushwindow.transform = cgaffinetransformidentity; [uiview animatewithduration:0.3 delay:0 options:uiviewanimationoptioncurveeaseout animations:^{ self.richpushwindow.transform = cgaffinetransformmakescale(0.01, 0.01); self.richpushwindow.alpha = 0.0f; } completion:^(bool finished) { appdelegate * appdelegate = (appdelegate*)[[uiapplication sharedapplication] delegate]; self.richpushwindow.hidden = yes; }];
now want call view controller on closing of html page. tried present myviewcotrlller
in block completion not presenting.
actually here problem there 2 uiwindows in app 1 of app , other used sdk. if try present view controller html page on separate uiwindow creates separate hierarchy , when close window removes presented viewconroller due parent-child relationship. , if not close window how come actual flow of app.
i want new controller should presented new window , after window should close , flow of app should not affected additional window. possible? if concept wrong, please if has idea
edit: second uiwindow never key window, becomes visible setting higher windowlevel , become hidden
the problem right after completion block richpushwindow gone, means trying present view controller on hidden window.
the solution simple. use main window present view controller. pseudocode:
add view viewcontoller main window subviews:
- [appdelegate.window addsubview:myviewcontroller.view];
modal:
- [appdelegate.window.rootviewcontroller presentmodalviewcontroller:myviewcontroller]
using view controller hierarchy:
- push viewcontroller main viewcontroller stack. example if have navigationcontroller, push there.
i hope helps!