【发布时间】:2018-01-22 12:25:21
【问题描述】:
我想通过点击按钮制作一个弹出框。但是当我点击我的按钮时,我的弹出框覆盖了我的所有页面。我的问题在哪里?
@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)
}
【问题讨论】:
-
您是否确保弹出窗口的父视图没有将 opaque 设置为 true?
-
是的,我已经确认没有将 opaque 设置为 true
标签: swift3