<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UISheetPresentationControllerDetent/customDetentWithIdentifier:resolver:",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UISheetPresentationControllerDetent(cm)customDetentWithIdentifier:resolver:"
  },
  "title" : "customDetentWithIdentifier:resolver:"
}
-->

# customDetentWithIdentifier:resolver:

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

```
+ (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`](/documentation/UIKit/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`](/documentation/UIKit/UIView/safeAreaInsets).[`bottom`](/documentation/UIKit/UIEdgeInsets/bottom) when the sheet is edge-attached, or `200` when the sheet is floating. Return [`UISheetPresentationControllerDetentInactive`](/documentation/UIKit/UISheetPresentationControllerDetentInactive) to specify that the detent is inactive according to the provided context.

    If the block depends on any external inputs, call [`invalidateDetents()`](/documentation/UIKit/UISheetPresentationController/invalidateDetents())     on the sheet when the external inputs change.

    Don’t set any properties on [`UISheetPresentationController`](/documentation/UIKit/UISheetPresentationController)     during the execution of this block.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)