5

I am integrating Pushwoosh SDK for Push Notification, which is using UIWindow to represent HTML page sent from 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 it 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 I want to call my view controller on closing of this HTML page. So I tried to present myviewcotrlller in this block completion but not presenting.

Actually here problem is that there are two UIWindows in my app one of app and other used by sdk. Now if i try to present view controller from this html page which is on separate UIWindow so it creates a separate hierarchy and when i close this window also removes my presented viewconroller due to parent-child relationship. And if do not close this window then how to come back to actual flow of app.

I want that new controller should be presented from that new window and after that window should be close and flow of app should not be affected by additional window. Is it possible? If my concept is wrong, Please help if anyone has idea

Edit: second uiwindow never be key window, it only becomes visible by setting higher windowlevel and become hidden

4

1 回答 1

1

问题是,在这个完成块之后richPushWindow 将消失,这实际上意味着您正试图在隐藏窗口上显示视图控制器。

解决方案非常简单。使用主窗口呈现视图控制器。一些伪代码:

将 ViewContoller 中的视图添加到主窗口子视图:

  1. [appDelegate.window addSubview:myViewController.view];

模态:

  1. [appDelegate.window.rootViewController presentModalViewController:myViewController]

使用视图控制器层次结构:

  1. 将您的 viewController 推送到主 viewController 堆栈。例如,如果您有导航控制器,只需将其推到那里。

我希望它有帮助!

于 2013-04-30T08:39:41.343 回答