【发布时间】:2018-12-11 13:15:30
【问题描述】:
是否可以使用 点击动画 创建一个 UIButton 类,该类会在用户每次触摸时自动调用 > 按钮?
import UIKit
class AnimatedButton: UIButton {
@objc private func buttonClicked(sender: UIButton) {
sender.transform = CGAffineTransform(scaleX: 0.6, y: 0.6)
// animation ...
}
}
所以我不想在必须调用 button.buttonclicked() 的 ViewController 中创建操作。每次我使用这个类时,这应该会自动发生。
有没有可能做这样的事情?
【问题讨论】:
标签: ios swift animation uibutton