iPad – uipopover and direction change

In my application, I have 3 UIPopOver. When the user clicks the button in the toolbar, they will appear. When the user rotates the iPad, if the pop-up window is already open, I need to make this popovers appear in the correct position (such as -willAnimateRotationToInterfaceOrientation:).

What should I do?

Thanks in advance!

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

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

For using presentPopoverFromRect method The pop-up window that is presented, when the interface orientation changes, the pop-up window control calls this method.

In my application, I have 3 UIPopOver. When the user clicks on the tool When the button in the bar, they will appear. When the user rotates the iPad, if the pop-up window is already open, I need to make this popovers appear in the correct position (such as -willAnimateRotationToInterfaceOrientation:).

I What should I do?

Thanks in advance!

In iOS 7.0 and later, you can implement the following methods available in UIPopoverControllerDelegate To complete:

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

For using The pop-up window presented by the presentPopoverFromRect method, when the interface orientation changes, the pop-up window control calls this method.

Leave a Comment

Your email address will not be published.