gpt4 book ai didi

ios - MMDrawerController 使用 Swift 预建动画

转载 作者:搜寻专家 更新时间:2023-10-31 22:49:52 25 4
gpt4 key购买 nike

我正在使用 MMDrawerController,我正在尝试更改抽屉滑出的方式。

在 objective-c 中,我会做

[drawerController setDrawerVisualStateBlock:[MMDrawerVisualState slideAndScaleVisualStateBlock]]

将抽屉滑出的方式更改为 Slide and Scale 动画。

然而,在 Swift 中,我似乎无法做到这一点。这就是我对 swift 的看法:

drawerController.setDrawerVisualStateBlock { (MMDrawerController!, MMDrawerSide, CGFloat) -> Void in

}

我无法在 block 内调用类似这样的MMRawerVisualState.slideAndScaleVisualStateBlock()。 Swift 不支持此功能吗?

最佳答案

在 Objective-c 中,您传递了一个类方法,它返回一个动画 block (MMDrawerControllerDrawerVisualStateBlock 的类型)。但是您没有在代码的 swift 版本中传递相同的方法(您正在实现它)。

drawerController.setDrawerVisualStateBlock(MMDrawerVisualState.slideAndScaleVisualStateBlock)

关于ios - MMDrawerController 使用 Swift 预建动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31081311/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com