![](/img/trans.png)
[英]How to dismiss popover View controller on iPad on tapping outside the view : IOS 9
[英]How do I prevent the user from tapping other UIViews (UIBarButtonItem) outside a Popover?
在我的應用程序中,我有一個Popover,它是從UIToolbar中的UIBarButtonItem生成的。 當前,當顯示Popover時,可以點擊UIToolbar中的其他按鈕。
當在Popover外部點擊時,如何仍然關閉該Popover,同時又不允許用戶在Popover之外點擊UIViews,該如何關閉呢? 我是否只需要禁用Popover外部的視圖?
// prepare Actions Menu
let storyboard = UIStoryboard(name: "Main", bundle: nil)
actionsVC = storyboard.instantiateViewController(withIdentifier: "actionsViewController") as! ActionsController
actionsVC.modalPresentationStyle = .popover
actionsVC.graph = graph
actionsVC.viewControllerDelegate = self
...
@IBAction func openActionsPopover(_ sender: UIBarButtonItem) {
actionsVC.popoverPresentationController?.barButtonItem = sender
actionsVC.popoverPresentationController?.passthroughViews?.removeAll()
present(actionsVC, animated: true)
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.