使用 UIPopoverBackgroundView 自定义的 Popover 中的边框问题

Issue with borders in a Popover customized using UIPopoverBackgroundView

我已经通过以下方式自定义了一个创建 UIPopoverBackgroundView 子类的 Popover:

class CustomPopoverBackgroundView: UIPopoverBackgroundView {

    override var arrowOffset: CGFloat {

        get{
          return self.arrowOffset
        }

        set{
        }
     }

     override var arrowDirection: UIPopoverArrowDirection {

        get {
          return UIPopoverArrowDirection.Up
        }

        set {                           
        }
      }

     override init(frame: CGRect) {

         super.init(frame: frame)        
         backgroundColor = UIColor(red: 0.19, green: 0.19, blue: 0.19, alpha: 1.0)

         var arrowView = UIImageView(image: UIImage(named: "12_24_pop_black"))
         arrowView.frame = CGRect(x: 17.0, y: -11.0, width: 24.0, height: 12.0)        
         self.addSubview(arrowView)
     }

     required init(coder aDecoder: NSCoder) {
         fatalError("init(coder:) has not been implemented")
     }

     override class func wantsDefaultContentAppearance() -> Bool {
        return false
     }   

     override class func contentViewInsets() -> UIEdgeInsets{
        return UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: 0.0)
     }

     override class func arrowHeight() -> CGFloat {
        return 0.0
     }

     override class func arrowBase() -> CGFloat{
        return 24.0
    }
}

我这样做主要是因为我想创建一个没有 Apple 默认提供的圆角边框的弹出窗口。

问题是在 Popover 里面我有一个灰色的 View,我不知道为什么 ViewController 没有完全展开,我可以看到我在上面的代码中设置的背景颜色(黑色)。

类似于这张 Popover 打开的图片:

我知道您可以为 Popover 加载边框,但就我而言,在某些情况下我会更改视图的背景颜色。

我想做的是展开显示为 Popover 的 ViewController 以避免圆角,或者我不知道是否有更好的解决方案。

如何解决这个问题?

提前致谢

您可以通过覆盖 Popover 控制器中的 de following 方法来解决此问题

override func viewWillAppear(animated: Bool)
{
    super.viewWillAppear(animated)
    self.view.superview?.layer.cornerRadius = 0
}