Class: UIPopoverController
Overview
The UIPopoverController class is used to manage the presentation of content in a popover. You use popovers to present information temporarily but in a way that does not take over the entire screen like a modal view does. The popover content is layered on top of your existing content in a special type of window. The popover remains visible until the user taps outside of the popover window or you explicitly dismiss it. Popover controllers are for use exclusively on iPad devices. Attempting to create one on other devices results in an exception.
Instance Attribute Summary (collapse)
-
- contentViewController
The view controller responsible for the content portion of the popover.
-
- delegate
The delegate you want to receive popover controller messages.
-
- passthroughViews
An array of views that the user can interact with while the popover is visible.
-
- popoverArrowDirection
readonly
The direction of the popover’s arrow.
-
- popoverBackgroundViewClass
The class to use for displaying the popover background content.
-
- popoverContentSize
The size of the popover’s content view.
-
- popoverLayoutMargins
The margins that define the portion of the screen in which it is permissible to display the popover.
-
- popoverVisible
readonly
A Boolean value indicating whether the popover is currently visible.
Instance Method Summary (collapse)
-
- dismissPopoverAnimated:
Dismisses the popover programmatically.
-
- initWithContentViewController:
Returns an initialized popover controller object.
-
- presentPopoverFromBarButtonItem:permittedArrowDirections:animated:
Displays the popover and anchors it to the specified bar button item.
-
- presentPopoverFromRect:inView:permittedArrowDirections:animated:
Displays the popover and anchors it to the specified location in the view.
-
- setContentViewController:animated:
Sets the view controller responsible for the content portion of the popover.
-
- setPopoverContentSize:animated:
Changes the size of the popover’s content view.
Methods inherited from NSObject
#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version
Constructor Details
This class inherits a constructor from NSObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class NSObject
Instance Attribute Details
- (UIViewController) contentViewController
The view controller responsible for the content portion of the popover. This property is initially set to the view controller passed to the initWithContentViewController: method. You can change the value of this property later to reflect a new set of content. Changing the value of this property swaps the new view controller in for the old one immediately and does not trigger an animation. If you want to animate the change, use the setContentViewController:animated: method instead.
- (Object) delegate
The delegate you want to receive popover controller messages. The popover controller uses its delegate to determine whether it should dismiss the popover and provides a notification when such an event occurs. For more information about the methods you can implement in your delegate, see UIPopoverControllerDelegate Protocol Reference.
- (Array) passthroughViews
An array of views that the user can interact with while the popover is visible. When a popover is active, interactions with other views are normally disabled until the popover is dismissed. Assigning an array of views to this property allows taps outside of the popover to be handled by the corresponding views.
- (UIPopoverArrowDirection) popoverArrowDirection (readonly)
The direction of the popover’s arrow. (read-only) The default value of this property is UIPopoverArrowDirectionUnknown. When you present the popover, the value changes to reflect the actual direction of the arrow being used by the popover. When the popover is subsequently dismissed, the value of this property returns to UIPopoverArrowDirectionUnknown.
- (Class) popoverBackgroundViewClass
The class to use for displaying the popover background content. The default value of this property is nil, which indicates that the popover controller should use the default popover appearance. Setting this property to a value other than nil causes the popover controller to use the specified class to draw the popover’s background content. The class you specify must be a subclass of UIPopoverBackgroundView.
- (CGSize) popoverContentSize
The size of the popover’s content view. This property represents the size of the content view that is managed by the view controller in the contentViewController property. The initial value of this property is set to value in the view controller’s contentSizeForViewInPopover property. Changing the value of this property overrides the default value of the current view controller. The overridden value persists until you assign a new content view controller to the receiver. Thus, if you want to keep your overridden value, you must reassign it after changing the content view controller. When changing the value of this property, the width value you specify must be at least 320 points and no more than 600 points. There are no restrictions on the height value. However, both the width and height values you specify may be adjusted to ensure the popup fits on screen and is not covered by the keyboard. If you change the value of this property while the popover is visible, the size change is animated.
- (UIEdgeInsets) popoverLayoutMargins
The margins that define the portion of the screen in which it is permissible to display the popover. The edge inset values are measured in points from the edges of the screen, relative to the current device orientation. Thus, the top-edge inset always reflects the top edge of the device from the user’s perspective, which changes depending on whether the user is holding the device in a portrait or landscape orientation. Remember that the device orientation is not always the same as the interface orientation—that is, the orientation of your window and views. Window orientations are typically fixed and view orientations are controlled by the owning view controller. In addition, if the rotation lock option is engaged, the interface does not change orientation at all, even when the device orientation changes. The default edge insets are 10 points along each edge. The popover controller automatically subtracts the status bar from the viable area when determining where to display the popover, so you do not need to factor the status bar height into your insets.
- (Boolean) popoverVisible (readonly)
A Boolean value indicating whether the popover is currently visible. (read-only) You must present the popover to make it visible.
Instance Method Details
- (Object) dismissPopoverAnimated(animated)
Dismisses the popover programmatically. You can use this method to dismiss the popover programmatically in response to taps inside the popover window. Taps outside of the popover’s contents automatically dismiss the popover.
- (Object) initWithContentViewController(viewController)
Returns an initialized popover controller object. When initializing a popover controller, you must specify the view controller object whose content is to be displayed in the popover. You can change this view controller later by modifying the contentViewController property.
- (Object) presentPopoverFromBarButtonItem(item, permittedArrowDirections:arrowDirections, animated:animated)
Displays the popover and anchors it to the specified bar button item. When presenting the popover, this method adds the toolbar that owns the button to the popover’s list of passthrough views. Thus, taps in the toolbar result in the action methods of the corresponding toolbar items being called. If you want the popover to be dismissed when a different toolbar item is tapped, you must implement that behavior in your action handler methods.
- (Object) presentPopoverFromRect(rect, inView:view, permittedArrowDirections:arrowDirections, animated:animated)
Displays the popover and anchors it to the specified location in the view.
- (Object) setContentViewController(viewController, animated:animated)
Sets the view controller responsible for the content portion of the popover.
- (Object) setPopoverContentSize(size, animated:animated)
Changes the size of the popover’s content view. When changing the size of the popover’s content, the width value you specify must be at least 320 points and no more than 600 points. There are no restrictions on the height value. However, both the width and height values you specify may be adjusted to ensure the popup fits on screen and is not covered by the keyboard.