Closed zyflovelam closed 4 years ago
TabBarItemContentVIew:
class BMTabBarContentView: ESTabBarItemContentView {
public var duration = 0.5
override init(frame: CGRect) {
super.init(frame: frame)
textColor = R.color.fourth()!
highlightTextColor = R.color.primary()!
iconColor = R.color.fourth()!
highlightIconColor = R.color.primary()!
renderingMode = .alwaysOriginal
itemContentMode = .alwaysOriginal
titleLabel.font = FontUtil.regular(size: 10)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func deselectAnimation(animated: Bool, completion: (() -> ())?) {
imageView.layer.removeAllAnimations()
completion?()
}
override func selectAnimation(animated: Bool, completion: (() -> ())?) {
self.bounceAnimation()
completion?()
}
override func reselectAnimation(animated: Bool, completion: (() -> ())?) {
self.bounceAnimation()
completion?()
}
private func bounceAnimation() {
let animation = CAKeyframeAnimation(keyPath: "transform.scale")
animation.values = [1.0, 1.25, 0.9, 1.15, 0.95, 1.02, 1.0]
animation.duration = duration
animation.calculationMode = CAAnimationCalculationMode.cubic
imageView.layer.add(animation, forKey: "bm:tabBar:select:animation")
}
}
Am I doing something wrong?
your animation duration
What should I do now? I have been removed the animation when the item deselected. and another thing happened, same as this thing, I tapped items quickly, 'Free Books' first, and then 'Community', and now, 'Free Books' still highlight, and 'Community' still unselect like before. and also, the 'Community Controller' displayed.
Could you help me, please?
your animation duration
OS: 10.15.3 Xcode: 11.3.1 (11C504) Language: Swift 4.2