Contents

customDetentWithIdentifier:resolver:

Creates a custom detent for a sheet by computing its value according to the properties of the provided context.

Declaration

+ (instancetype) customDetentWithIdentifier:(UISheetPresentationControllerDetentIdentifier) identifier resolver:(CGFloat (^)(id<UISheetPresentationControllerDetentResolutionContext> context)) resolver;

Parameters

  • identifier:

    An identifier for the detent. Specify a unique identifier for each custom detent for a sheet. If you don’t specify an identifier, the system generates a random identifier.

  • resolver:

    A block for resolving the detent value with an input of type Uisheetpresentationcontrollerdetentresolutioncontext. The value you return from this block is a height within the safe area of the sheet. For example, return 200 for a detent with a height of 200 plus Safeareainsets.Bottom when the sheet is edge-attached, or 200 when the sheet is floating. Return Uisheetpresentationcontrollerdetentinactive to specify that the detent is inactive according to the provided context.

    If the block depends on any external inputs, call Invalidatedetents() on the sheet when the external inputs change.

    Don’t set any properties on Uisheetpresentationcontroller during the execution of this block.

See Also

Creating a custom detent