Categories
Computing ios iphone

Positioning UIPopoverController

The iPad has a great UI control – the UIPopoverController – most notably used in its email app when it is in portrait mode. To show, or 'present' a UIPopoverController you have two methods:

– presentPopoverFromBarButtonItem:permittedArrowDirections:animated: 
which is used to present the popover from a UIBarButton in, say, a navigation bar.

– presentPopoverFromRect:inView:permittedArrowDirections:animated:
which is used to present the popover from a location specified by a CGRect as its first parameter.

Unlike other UI controls, this CGRect actually specifies the location of the UIControl you want the popover to point at, or at least be next to. For example, the button that triggers the showing of the UIPopoverController. That is, the UIPopoverController does not use that CGRect for its own positioning – but as an 'advice' where it should be hovering.

You can also tell it where you want it to hover using the permittedArrowDirections flags, which will try to place it say, above (if the arrow direction flag is down), to the left (if the arrow direction is right), etc.

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

 

Share