skip to Main Content

How can I use LargestUndimmedDetentIdentifier with custom SheetPresentation height ?

I have a UISheetPresentationController with two customs Detents and I don’t find how can interact with content underneath.

        UISheetPresentationController sheet = NavigationController!.SheetPresentationController!;
        sheet.PrefersGrabberVisible = true;
        sheet.PrefersScrollingExpandsWhenScrolledToEdge = false;
        sheet.WidthFollowsPreferredContentSizeWhenEdgeAttached = true;
        sheet.Delegate = new SheetPresentationControllerDelegate();
        UISheetPresentationControllerDetent smallDetent = UISheetPresentationControllerDetent.Create("small", _ => 60);
        UISheetPresentationControllerDetent msmallPlusDetent = UISheetPresentationControllerDetent.Create("smallPlus", _ => 350);
        sheet.Detents = new UISheetPresentationControllerDetent[]
        {
            smallDetent,
            msmallPlusDetent
        };
        sheet.LargestUndimmedDetentIdentifier = ????; (what can I put here?)

2

Answers


  1. Your custom detents height is an object that represents a height where a sheet naturally rests. The LargeUndimmedDetentIdentifier property needs to be an enumeration of UISheetPresentationControllerDetentIdentifier. Its function is that it doesn’t dim the view underneath the sheet. At present, iOS only defines two enumeration types, Medium and Large, and there is no way to customize changes for the time being.
    You can only use these two ways:sheet.LargestUndimmedDetentIdentifier=UISheetPresentationControllerDetentIdentifier.Medium/Large

    For more details, you can refer to:

    largestUndimmedDetentIdentifier | AppleDeveloper

    UISheetPresentationControllerDetentIdentifier | AppleDeveloper

    Login or Signup to reply.
  2. it asks detents identifier.. which is a property of "detent"
    you can provide like sheet.detents[0].identifier

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search