UIPopOver and orientation change

Knodel picture Knodel · Jun 9, 2010 · Viewed 9.7k times · Source

In my app I have 3 UIPopOvers. They appear when user taps buttons in the toolbar. I need to make the popovers appear in the correct place when user rotates iPad if the popover is already opened (like the -willAnimateRotationToInterfaceOrientation:).

How can I do it?

Thanks in advance!

Answer

Nitin Gupta picture Nitin Gupta · Jan 7, 2014

In iOS 7.0 and later, it can be done by implementing following method available in UIPopoverControllerDelegate:

(void)popoverController:(UIPopoverController *)popoverController willRepositionPopoverToRect:(inout CGRect *)rect inView:(inout UIView **)view

For popovers that were presented using the presentPopoverFromRect method, the popover controller calls this method when the interface orientation changes.