UIViewControllerPreviewingDelegate.GetViewControllerForPreview(IUIViewControllerPreviewing, CGPoint) UIViewControllerPreviewingDelegate.GetViewControllerForPreview(IUIViewControllerPreviewing, CGPoint) Method

Definition

Called when the user performs the 3D Touch "Peek" pressure gesture.

[Foundation.Export("previewingContext:viewControllerForLocation:")]
public abstract UIKit.UIViewController GetViewControllerForPreview (UIKit.IUIViewControllerPreviewing previewingContext, CoreGraphics.CGPoint location);
abstract member GetViewControllerForPreview : UIKit.IUIViewControllerPreviewing * CoreGraphics.CGPoint -> UIKit.UIViewController

Parameters

previewingContext
IUIViewControllerPreviewing IUIViewControllerPreviewing

The context in which the 3D Touch is occurring..

location
CGPoint CGPoint

The location where the 3D touch is occurring.

Returns

The UIViewController that provides the 3D Touch "Peek" UX.

Implements

Remarks

On hardware that supports 3D Touch (see ForceTouchCapability), this method is called when the 3D Touch triggers the "Peek" action.

One feature of 3D Touch is the ability to blur the background except for the element that is the subject of the touch. Application developers control this behavior by to setting the SourceRect to the control that should not be blurred. For instance, in a table, one can prevent the selected cell from blurring by retrieving the cell at the location at which the 3D Touch is occurring and then setting the SourceRect to the Frame of the cell:


// Obtain the index path and the cell that was pressed. (Checks for null not shown.)
var indexPath = TableView.IndexPathForRowAtPoint (location);
var cell = TableView.CellAt (indexPath);
previewingContext.SourceRect = cell.Frame;

Applies to