ios UISheetPresentationController和带自定义定位器的UndimmedDetentIdentifier

y53ybaqx  于 2022-12-05  发布在  iOS
关注(0)|答案(1)|浏览(160)

如何将LargestUndimmedDetentIdentifier与自定义图纸演示高度配合使用?
我有一个UISheetPresentationController,它有两个自定义制动器,但我不知道如何与下面的内容交互。

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?)
hyrbngr7

hyrbngr71#

您自定义的detents height是一个对象,表示表单自然停留的高度,LargeUndimmedDetentIdentifier属性需要是UISheetPresentationControllerDetentIdentifier的一个枚举,它的作用是不会使表单下面的视图变暗,目前iOS只定义了Medium和Large两个枚举类型,暂时没有办法自定义更改,只能使用这两种方式:sheet.LargestUndimmedDetentIdentifier=UISheetPresentationControllerDetentIdentifier.Medium/Large
有关详细信息,请参阅:
largestUndimmedDetentIdentifier | AppleDeveloper
UISheetPresentationControllerDetentIdentifier | AppleDeveloper

相关问题