     }
     
     func calculatePopoverViewFrame() -> CGRect {
-        let popoverY = self.fromView.convert(self.fromView.frame.origin, to: self.view).y + self.fromView.bounds.height
+        let popoverY = self.fromView.convertOriginToWindow().y + self.fromView.bounds.height
         
         let preferredContentSize = self.contentViewController.preferredContentSize
         var popoverWidth = preferredContentSize.width

            
            let arrowPath = CGMutablePath()
            
            arrowPath.move(to: CGPoint(x: arrowWidth / 2, y: 0))
            arrowPath.addLine(to: CGPoint(x: arrowWidth, y: arrowHeight))
            arrowPath.addLine(to: CGPoint(x: 0, y: arrowHeight))
            arrowPath.closeSubpath()
            
            context?.addPath(arrowPath)

    override open func viewDidLoad() {
        super.viewDidLoad()
        
        self.view.backgroundColor = UIColor(white: 0, alpha: 0.6)
        self.popoverView = DKPopoverView(arrowColor: self.arrowColor)
        self.view.addSubview(self.popoverView)
    }
