2
var popVC:UIPopoverController?
popVC = UIPopoverController(contentViewController: viewControl)
popVC?.delegate = self
popVC?.setContentSize(highlight!.frame.size, animated: false)
highlight?.popVC = popVC
if let dir = self.phData.direction {
        var popDir = UIPopoverArrowDirection.any
        switch dir {
        case "left":
            popDir = UIPopoverArrowDirection.left
            break
        case "right":
            popDir = UIPopoverArrowDirection.right
            break
        case "top":
            popDir = UIPopoverArrowDirection.up
            break
        case "down":
            popDir = UIPopoverArrowDirection.down
            break
        default:
            break
        }
        popVC?.present(from: self.frame, in: inView, permittedArrowDirections: popDir, animated: true)
  }else{
        popVC?.present(from: self.frame, in: inView, permittedArrowDirections: UIPopoverArrowDirection.any, animated: true)
    }

上面的代码已弃用,现在我想将其更改为 UIPopoverPresentationController。我尝试搜索答案,但答案不适合 NSObject 子类,所以我很困惑。请帮我。提前致谢。

4

0 回答 0