如何将popover定位在迅速死亡的中心(它有点偏离中心)

时间:2015-12-31 17:05:00

标签: ios swift uipopovercontroller popover

以下代码显示无箭头弹出窗口。我试图在视图中将它定位为死点,但它有点偏离。我不知道该怎么做 - 我是一个初学者。

@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
        }
    }
}

这就是它的样子:

enter image description here

0 个答案:

没有答案