ARSPopover icon indicating copy to clipboard operation
ARSPopover copied to clipboard

How to dismiss popover?

Open imuhammadjabbar opened this issue 9 years ago • 1 comments

How to dismiss popover? There is no property to dismiss the popover If I need to dismiss it after the UITableView Row selection inside popover.

imuhammadjabbar avatar Aug 19 '16 12:08 imuhammadjabbar

Hello @imuhammadjabbar , Please find below an answer to your question

self.present(popoverController, animated: true) {
            popoverController.insertContent(intoPopover: { (popover, popoverPresentedSize, popoverArrowHeight) in
                // 1. init
                let button = UIButton(type: .roundedRect)
                button.setTitle("Close", for: .normal)
                button.sizeToFit()
                button.center = CGPoint(x: 50, y: 25)
                // 2. action => popover!.close is a function that exist in ARSPopover
                button.addTarget(popover, action: #selector(popover!.close), for: .touchUpInside)
                // 3. add to view
                popover?.view.addSubview(button)
            })
        }
@objc func close() {
        self.dismiss(animated: true)
    }

hamada147 avatar Feb 06 '19 21:02 hamada147