UIPopoverControllerDelegate Protocol Reference

Conforms to
Framework
/System/Library/Frameworks/UIKit.framework
Availability
Available in iOS 3.2 and later.
Companion guide
Declared in
UIPopoverController.h
Related sample code

Overview

The UIPopoverControllerDelegate protocol defines the methods you can implement for the delegate of a UIPopoverController object. Popover controllers notify their delegate whenever user interactions would cause the dismissal of the popover and, in some cases, give the user a chance to prevent that dismissal.

For more information about the UIPopoverController class, see UIPopoverController Class Reference.

Tasks

Responding to Popover Position Changes

Managing the Popover’s Dismissal

Instance Methods

popoverController:willRepositionPopoverToRect:inView:

Tells the delegate that the popover controller needs to change the popover’s location in its view.

- (void)popoverController:(UIPopoverController *)popoverController willRepositionPopoverToRect:(inout CGRect *)rect inView:(inout UIView **)view
Parameters
popoverController

The popover controller changing the position of its content.

rect

On input, the proposed rectangle for the popover. This popover is in the coordinate space of the view in the view parameter. If you want to propose a different rectangle for the popover, put the new value in this parameter.

view

On input, the proposed view for containing the popover. If you want to propose a different view for the popover, put the new view in this parameter.

Discussion

For popovers that were presented using the presentPopoverFromRect:inView:permittedArrowDirections:animated: method, the popover controller calls this method when the interface orientation changes. Your delegate can use this method to adjust the proposed position of the popover. The popover controller does not call this method if you presented the popover from a bar button item.

Availability
  • Available in iOS 7.0 and later.
Declared In
UIPopoverController.h

popoverControllerDidDismissPopover:

Tells the delegate that the popover was dismissed.

- (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController
Parameters
popoverController

The popover controller that was dismissed.

Discussion

The popover controller does not call this method in response to programmatic calls to the dismissPopoverAnimated: method. If you dismiss the popover programmatically, you should perform any cleanup actions immediately after calling the dismissPopoverAnimated: method.

You can use this method to incorporate any changes from the popover’s content view controller back into your application. If you do not plan to use the object in the popoverController parameter again, it is safe to release it from this method.

Availability
  • Available in iOS 3.2 and later.
Declared In
UIPopoverController.h

popoverControllerShouldDismissPopover:

Asks the delegate if the popover should be dismissed.

- (BOOL)popoverControllerShouldDismissPopover:(UIPopoverController *)popoverController
Parameters
popoverController

The popover controller to be dismissed.

Return Value

YES if the popover should be dismissed or NO if it should remain visible.

Discussion

This method is called in response to user-initiated attempts to dismiss the popover. It is not called when you dismiss the popover using the dismissPopoverAnimated: method of the popover controller.

If you do not implement this method in your delegate, the default return value is assumed to be YES.

Availability
  • Available in iOS 3.2 and later.
Declared In
UIPopoverController.h