My app does not fill the entire screen. It is a rectangle, lets say, 1000x500 pixels. When the app is on the middle of the screen and I show a popover it appears like this:
What is ugly, half of popover outside the app area.
But if the app is near the left edge of the screen, then it appears the way I want, like this:
What is pretty, all the popover contained inside the app's area.
Is there a way to force the popover to always appear like this second case, inside the app's area?
As far as I know you have very little control on how a popover is displayed. Apple reserves themselves the right to make changes on how to display popover's and this would not be possible if you were in total control. You can define the preferred edge and the preferred width and pretty much anything else is up to the system. If you need more control yourself, you need to draw the whole thing yourself (which is possible, just a a lot of work) or use some third party framework.