自从迁移到 Swift 5 后,已将 allowedArrowDirections 设置为 .left/.right 的弹出框渲染得稍微偏离了它们应该在的位置。但是,当将 allowedArrowDirections 设置为 .top/.bottom 时,问题就消失了。请看下图:
我将弹出窗口设置如下:
let popoverController = colorPickerVC.popoverPresentationController
popoverController!.permittedArrowDirections = .right
popoverController!.sourceRect = CGRect(x: Constants.uiPopoverArrowHorizontallOffset2, y: self.buttonLayersPicker.frame.height/2 ,width: 0,height: 0) // anchor popover to middle-left of calling button
popoverController?.backgroundColor = Constants.uiColorPopupBgDark1 // set the color of the popover arrow
popoverController?.passthroughViews = [viewControllerMain.view] // allow interaction with bg view while popover is being displayed
// present popover
viewControllerMain.present(colorPickerVC, animated: true, completion: nil)
有没有人提出这个问题?如何解决?
提前致谢