Displaying UIPopoverController in the wrong place

I switch the views in the window. Orientation is sometimes confused.

In one of the windows, when I try to display a popover that should be attached to a toolbar button, it appears in a place on the screen. If I physically change the orientation of the device, the popover redraws in the right place. If I return it again, it will be drawn in the right place. If I reject the popover and try to display it again, it will appear again in the wrong place.

Suggestions appreciated.

+4
source share
2 answers

Here, when you display the popover controller from the view, first you need to check what information you have now, and based on the orientation, you can select a frame and open the popover controller from the current view. You can do the following:

if(UIAppDelegate.intOrientation == 1) { popoverController.popoverContentSize = CGSizeMake(570, 720); [self.popoverController presentPopoverFromRect:CGRectMake(100, 150, 570, 720) inView:self.view permittedArrowDirections:NO animated:YES]; } else { popoverController.popoverContentSize = CGSizeMake(820, 500); [self.popoverController presentPopoverFromRect:CGRectMake(102, 135, 820, 500) inView:self.view permittedArrowDirections:NO animated:YES]; } 
+1
source

The problem disappeared, not knowing why. I discovered an issue with Apple Developer Support. They looked at my code and came up with a couple of undocumented recommendations.

No need to mix screen orientation between switchable views. Let them all support the landscape or not, a portrait or not.

They also said that only one controller should control the screen at a time.

This issue arose from iOS4.2 on the iPad. I don't know if this applies anymore.

+1
source

All Articles