【问题标题】:MMDrawerController Pre Built Animations with SwiftMMDrawerController 使用 Swift 预建动画
【发布时间】:2015-06-26 20:08:12
【问题描述】:

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

在目标 C 中,我会这样做

[drawerController setDrawerVisualStateBlock:[MMDrawerVisualState slideAndScaleVisualStateBlock]]

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

然而,在 Swift 中,我似乎无法做到这一点。这就是我使用 swift 的地方:

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

}        

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

【问题讨论】:

    标签: ios xcode swift xcode6 mmdrawercontroller


    【解决方案1】:

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

    drawerController.setDrawerVisualStateBlock(MMDrawerVisualState.slideAndScaleVisualStateBlock)
    

    【讨论】:

    • 这实际上是我必须使用的代码:drawerController.setDrawerVisualStateBlock(MMDrawerVisualState.slideAndScaleVisualStateBlock()!) Cheers!
    • 你们俩,你的回答太棒了。谢谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-30
    • 2019-09-28
    • 2015-11-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多