ASIACheckmarkView 3.0.1

ASIACheckmarkView 3.0.1

测试已测试
语言语言 SwiftSwift
许可 MIT
发布最新版本2016年11月
SwiftSwift 版本3.0
SPM支持 SPM

Andrzej MichniaAndrzej Michnia 维护。



  • Andrzej Michnia

ASIACheckmarkView

可定制的勾选按钮视图。允许您在状态之间轻松动画转换,可选的中间“旋转”状态 - 如果您想美丽地 morph 两种状态之间,但需要在中间等待 API。简洁而现代的外观,同时易于使用。支持 Swift 3.0.1。

屏幕截图

Custom style Screenshot

使用方法

在故事板中添加按钮,将其类设置为 ASIACheckmarkView。检查属性检查器并调整值,以获得所需效果。

注意,旋转动画在故事板 IBDesignable 中不起作用。

Custom style Screenshot

代码

动画状态转换

Swift

let checkmark: ASIACheckmarkView

func changeState() {
        let newValue = !checkmark.boolValue // boolValue describes current checkmark state
        checkmark.animate(checked: newValue) // animate to state you want
}

func changeStateWithCompletion() {
        let newValue = !checkmark.boolValue // boolValue describes current checkmark state
        checkmark.animateTo(newValue){
            print("changed state to \(checkmark.boolValue)")
        }
}

@IBAction func changeStateWithSpinner() {
        let newValue = !checkmark.boolValue
        checkmark.animate(checked: newValue)    // animate to state you want
        checkmark.isSpinning = true       // PLACE THIS AFTER ANIMATE TO CALL!
}

func endSpinning() {
        // OPTIONAL - You might call "checkmark.animate(checked: some_value)" here
        // - if you want to alter state after finishing spinning
        // (Yes -> spinning -> Yes) for example
        checkmark.isSpinning = false
}

致谢

Andrzej Michnia 创建。

动画设计由 Asia Michnia 完成

许可

ASIACheckmarkView 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。