How to make UIPopoverController keep same position after rotating?

前端 未结 13 1131
粉色の甜心
粉色の甜心 2021-01-30 18:21

I can\'t keep popover the same position on the screen after rotation. Is there any good way to do that, because just setting some frame to popover works terrible after rotating.

13条回答
  •  野的像风
    2021-01-30 18:58

    I've tried just to set new rect (rect.initialize(...)) and it works.

    func popoverPresentationController(popoverPresentationController: UIPopoverPresentationController, willRepositionPopoverToRect rect: UnsafeMutablePointer, inView view: AutoreleasingUnsafeMutablePointer) {
    
            if popoverPresentationController.presentedViewController.view.tag == Globals.PopoverTempTag
            {
                rect.initialize(getForPopupSourceRect())
            }
        }
    

提交回复
热议问题