2011-06-22 45 views
4

我有一個singleton popover,所以我一次只顯示一個popover。當我做我的共享popover並選擇AirPrint時,共享popover正確消失,顯示AirPrint彈出窗口。如何解除AirPrint Popover?

但是,如果我再次按下共享按鈕,共享彈出窗口將顯示在AirPrint彈出窗口的頂部。

我找不到引用AirPrint彈出窗口的方法來解除它。

一些進一步的信息 - 我有在屏幕底部的工具欄上的UIBarButtonItems和嵌套在屏幕頂部的navigationBar的rightBarButtonItem內的四個UIBarButtonItems。

屏幕底部的UIBarButtonItems會自動正確關閉AirPrint彈出窗口,但頂部的嵌套窗口不會自動關閉。

但是,如果我知道AirPrint彈出窗口的名稱,我可以從頂部按鈕的代碼中解僱它。

回答

4

實際的「AirPrint」UIPopoverController不適用於您。但是,如果您需要以編程方式使其消失,請執行以下操作:

[[UIPrintInteractionController sharedPrintController] dismissAnimated:YES]; 
+0

非常感謝您:) – Caroline

2

您應該能夠關閉打印機彈出視圖,如下面的代碼。

UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController]; 
[pic dismissAnimated:YES];