diff --git a/TSPopover/TSPopoverController.m b/TSPopover/TSPopoverController.m index fb2fc74..87a6d5b 100644 --- a/TSPopover/TSPopoverController.m +++ b/TSPopover/TSPopoverController.m @@ -188,7 +188,12 @@ - (void) showPopoverWithPoint:(CGPoint)senderPoint UIWindow *appWindow = [[UIApplication sharedApplication] keyWindow]; //[appWindow addSubview:self.view]; - [appWindow.rootViewController.view addSubview:self.view]; + if (appWindow.rootViewController.presentedViewController != nil) { + [appWindow.rootViewController.presentedViewController.view addSubview:self.view]; + } + else { + [appWindow.rootViewController.view addSubview:self.view]; + } [UIView animateWithDuration:0.0