暫無描述

ActionSheetAnimator.swift 1.0KB

    // // ActionSheetAnimator.swift // PaiAi // // Created by ffib on 2018/12/17. // Copyright © 2018 yb. All rights reserved. // import UIKit public struct ActionSheetAnimator: PresentAnimatable { public func contentViewAppearAnimation(duration: TimeInterval, in view: UIView) { let animation = CATransition() animation.duration = duration animation.type = .moveIn animation.subtype = .fromTop view.layer.add(animation, forKey: nil) } public func contentViewDisappearAnimation(duration: TimeInterval, in view: UIView) { let fromValue = view.layer.position.y let toValue = fromValue + view.bounds.height let animation = CABasicAnimation(keyPath: "position.y") animation.toValue = toValue animation.duration = duration animation.fromValue = fromValue animation.isRemovedOnCompletion = false animation.fillMode = .forwards view.layer.add(animation, forKey: nil) } }