UIPreviewAction
A preview action, or peek quick action, is displayed below a peek when a user swipes the peek upward. A peek quick action typically selects a deep link to your app and has a title, a style, and a handler.
Peeks and peek quick actions are available on devices that support 3D Touch.
-
Creates a peek quick action using a specified title, style, and handler.
Declaration
Swift
convenience init(titletitle: String, stylestyle: UIPreviewActionStyle, handlerhandler: (UIPreviewAction, UIViewController) -> Void)Objective-C
+ (instancetype)actionWithTitle:(NSString *)titlestyle:(UIPreviewActionStyle)stylehandler:(void (^)(UIPreviewAction *action, UIViewController *previewViewController))handlerParameters
titleThe quick action’s title.
styleThe quick action’s style. For a complete list of styles, see the
UIPreviewActionStyleenumeration in UIPreviewActionItem Protocol Reference.handlerA block that is called when the user selects the peek quick action. The block takes the following parameters:
actionThe peek quick action selected by the user.
previewViewControllerThe view controller displayed as the peek.
Return Value
A newly-created peek quick action.
Availability
Available in iOS 9.0 and later.
See Also
-
The block called when the peek quick action is selected by the user. (read-only)
Declaration
Swift
var handler: (UIPreviewActionItem, UIViewController) -> Void { get }Objective-C
@property(nonatomic, copy, readonly, nonnull) void (^handler)(id<UIPreviewActionItem> action, UIViewController *previewViewController)Discussion
The handler is set when the peek quick action is instantiated; it is immutable.
Availability
Available in iOS 9.0 and later.
See Also
Copyright © 2016 Apple Inc. All rights reserved. Terms of Use | Privacy Policy | Updated: 2015-09-16
