Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIPopOver and orientation change

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!

like image 414
Knodel Avatar asked Jun 09 '10 17:06

Knodel


2 Answers

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.

like image 157
Nitin Gupta Avatar answered Oct 19 '22 16:10

Nitin Gupta


The only solution I've found so far is just closing the popover when the device is rotated/

like image 37
Knodel Avatar answered Oct 19 '22 18:10

Knodel