Anchor Position UIPopoverController

I have a UIPopOverController for which the content controller is a UINavigationController. I resize the popover to fit the size of the contents of the controller that popped / popped into it. First I introduce a popover using a method presentPopoverFromRect:inView:permittedArrowDirections:animated:. The snap position indicates the center of the rectangle that I passed as an argument. If I click on the controller (whose content size is small) in the navigationController, the popover shrinks from below and moves above the rectangle that I mentioned earlier.

I tried to imagine a popover every time (for push / pop), the anchor position remains the same point. But the animation does not look good.

what needs to be done so that the position of the binding remains the same, regardless of the size change of the popover change?

+1
source share
2 answers

I ran into the same problem and it seems like the method call presentPopoverFromRectwill keep the binding in the same position again

eg.

[self.myPopOver presentPopoverFromRect:rectOrigin inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:NO];

Hope this works in your case too.

+2
source

Change frame after UIPopoverController view:

 [popupController presentPopoverFromRect:btn.frame inView:self.view permittedArrowDirections:0 animated:YES];

CGRect popupFrame = popupController.contentViewController.view.superview.superview.superview.frame;
popupFrame.origin.y = btn.frame.origin.y + btn.frame.size.height+75;

popupController.contentViewController.view.superview.superview.superview.frame = popupFrame;
0
source

All Articles