我想从按钮水龙头做一个弹出窗口。但当我点击我的按钮时,我的弹出窗口覆盖了我的所有页面。我的问题在哪里?
@IBAction func buttonTap(sender:UIButton){
// get a reference to the view controller for the popover
let popController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "popoverId")
// set the presentation style
popController.modalPresentationStyle = UIModalPresentationStyle.popover
// set up the popover presentation controller
popController.popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection.up
popController.popoverPresentationController?.delegate = self
popController.popoverPresentationController?.sourceView = sender // button
popController.popoverPresentationController?.sourceRect = sender.bounds
// present the popover
self.present(popController, animated: true, completion: nil)
}
答案 0 :(得分:0)
我认为您需要更改modalPresentaionStyle
popController.modalPresentationStyle = .overCurrentContext