以下代码显示无箭头弹出窗口。我试图在视图中将它定位为死点,但它有点偏离。我不知道该怎么做 - 我是一个初学者。
@IBAction func PostPop(sender: AnyObject) {
self.performSegueWithIdentifier("showPostPop", sender: self)
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "showPostPop" {
let vc = segue.destinationViewController
let controller = vc.popoverPresentationController
if let _controller = controller {
//set anchor and remove arrow
_controller.sourceRect = CGRectMake(CGRectGetMidX(self.view.bounds), CGRectGetMidY(self.view.bounds), 0, 0)
_controller.permittedArrowDirections = UIPopoverArrowDirection(rawValue:0)
}
if controller != nil
{
controller?.delegate = self
}
}
}
这就是它的样子: