增加点击按钮图片放大缩小效果

效果类似网易新闻点击tabbar下部按钮动画效果,以后可以添加到UIButton的Extension中提升便利性:

open func bounceEffect() {
        UIView.animate(withDuration: 0.3, animations: { [weak self] in
            self?.imageView?.layer.setAffineTransform(CGAffineTransform(scaleX: 0.8,y: 0.8))
        }) { (_) in
            self.imageView?.layer.setAffineTransform(CGAffineTransform.identity)
        }
    }

你可能感兴趣的:(增加点击按钮图片放大缩小效果)