Instance Method

registerForPreviewingWithDelegate:sourceView:

Registers a view controller to participate with 3D Touch preview (peek) and commit (pop).

Declaration

- (id<UIViewControllerPreviewing>)registerForPreviewingWithDelegate:(id<UIViewControllerPreviewingDelegate>)delegate sourceView:(UIView *)sourceView;

Parameters

delegate

The delegate object mediates the presentation of views from the preview (peek) view controller and the commit (pop) view controller. In practice, these two are typically the same view controller. The delegate performs this mediation through your implementation of the methods of the UIViewControllerPreviewingDelegate protocol.

sourceView

The view, in the view hierarchy of the receiver of this method call, that invokes a preview when pressed by the user.

When lightly pressed, the source view remains visually sharp while surrounding content blurs. When pressed more deeply, the system calls the previewingContext:viewControllerForLocation: method in your delegate object, which presents the preview (peek) view from another view controller.

Return Value

A context object for managing the preview. This object conforms to the UIViewControllerPreviewing protocol.

Discussion

A preview, or peek in end-user terminology, provides additional content related to the view the user pressed (that is, related to the sourceView view).

Calling this method does three things:

  • Registers the previewing view controller (the one that receives this method call) to participate with 3D Touch preview and commit

  • Designates the source view, from the receiver’s view hierarchy, as the view to respond to a forceful touch

  • Designates a delegate object for mediating the presentation of the preview (peek) and commit (pop) views as a user requests them in turn by pressing more deeply

You can designate more than one source view for a single registered view controller, but you cannot designate a single view as a source view more than once.

The lifetime of this method’s returned context object is managed by the system. If you need to explicitly unregister a view controller, pass its context object to the unregisterForPreviewingWithContext: method. If you do not unregister a view controller, the system automatically unregisters it when the view controller is deallocated.

See Also

Methods

- unregisterForPreviewingWithContext:

Unregisters a previously registered view controller identified by its context object.

Deprecated
- automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers

Returns a Boolean value that indicates whether appearance and rotation methods are forwarded.

Deprecated
- canPerformUnwindSegueAction:fromViewController:withSender:

Called on a view controller to determine whether it wants to respond to an unwind action.

Deprecated
- didAnimateFirstHalfOfRotationToInterfaceOrientation:

Sent to the view controller after the completion of the first half of the user interface rotation.

Deprecated
- didRotateFromInterfaceOrientation:

Sent to the view controller after the user interface rotates.

Deprecated
- dismissModalViewControllerAnimated:

Dismisses the view controller that was presented by the receiver.

Deprecated
- dismissMoviePlayerViewControllerAnimated

Dismisses a movie player view controller using the standard movie player transition.

Deprecated
- viewControllerForUnwindSegueAction:fromViewController:withSender:

Called when an unwind segue action wants to search a container'€™s children for a view controller to handle the unwind action.

Deprecated
+ prepareInterstitialAds

Prepares the iAd framework to display interstitial ads, which may involve prefetching ad assets.

Deprecated
- presentModalViewController:animated:

Presents a modal view managed by the given view controller to the user.

Deprecated
- presentMoviePlayerViewControllerAnimated:

Presents the movie player view controller using the standard movie player transition.

Deprecated
- requestInterstitialAdPresentation

Asks the framework to display an interstitial ad.

Deprecated
- rotatingFooterView

Returns the footer view to transition during an interface orientation change.

Deprecated
- rotatingHeaderView

Returns the header view to transition during an interface orientation change.

Deprecated
- segueForUnwindingToViewController:fromViewController:identifier:

Called when an unwind segue action needs to transition between two view controllers.

Deprecated
- shouldAutomaticallyForwardRotationMethods

Returns a Boolean value indicating whether rotation methods are forwarded to child view controllers.

Deprecated
- shouldAutorotateToInterfaceOrientation:

Returns a Boolean value indicating whether the view controller supports the specified orientation.

Deprecated
- viewDidUnload

Called when the controller'€™s view is released from memory.

Deprecated
- viewWillUnload

Called just before releasing the controller'€™s view from memory.

Deprecated
- willAnimateFirstHalfOfRotationToInterfaceOrientation:duration:

Sent to the view controller before performing the first half of a user interface rotation.

Deprecated
- willAnimateRotationToInterfaceOrientation:duration:

Sent to the view controller before performing a one-step user interface rotation.

Deprecated
- willAnimateSecondHalfOfRotationFromInterfaceOrientation:duration:

Sent to the view controller before the second half of the user interface rotates.

Deprecated
- willRotateToInterfaceOrientation:duration:

Sent to the view controller just before the user interface begins rotating.

Deprecated