I am switching views within the window. The orientation is sometimes confused.
Within one of the windows, when I attempt to display a popover which should be attached to a toolbar button, it is displayed in the location on the screen. If I physically change the orientation of the device, the popover is redraw in the correct location. If I switch it back again, it is drawn in the correct location. If I dismiss the popover and try to display it again,开发者_开发问答 it again displays in the wrong location.
Suggestions appreciated.
Here when you display the popover controller from the view, first you need to check which orinetation you have now and based on the orientation you can choose the frame and open the popover controller from the current view. You can do like as follows:
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];
}
Problem went away, not sure why. I had opened an issue with Apple developer support. They looked through my code and came up with a couple of undocumented guidelines.
One was not to mix screen orientations between views being switched. Have them all consistently support landscape or not, portrait or not.
They also said that only one controller should be managing the screen at a time.
This issue came up with iOS4.2 on an iPad. Don't know if this applies anymore.
精彩评论