Instance Method


Called when the user has pressed a source view in a previewing view controller, thereby obtaining a surrounding blur to indicate that a preview (peek) is available.



- (UIViewController *)previewingContext:(id<UIViewControllerPreviewing>)previewingContext viewControllerForLocation:(CGPoint)location;



The context object for the previewing view controller.


The location of the touch in the source view’s coordinate system.

Return Value

The view controller whose view you want to provide as the preview (peek), or nil to disable preview..


Implement this method to return the preview view controller.

To indicate that a particular portion of the source view is responding to the user’s force touch, set the context object’s sourceRect property to the desired rectangle. For example, if the context object’s sourceView property is a table view, you can set the sourceRect property to the frame of the row indicated by the location parameter’s value. When the system presents the preview (peek), it appears to originate from the selected row.

You can disable preview by returning nil from this method.

See Also

Providing Preview and Commit Views for 3D Touch

- previewingContext:commitViewController:

Called to let you prepare the presentation of a commit (pop) view from your commit view controller.