📜  swift uibutton 以编程方式设置 ontap 功能 - Swift 代码示例

📅  最后修改于: 2022-03-11 15:01:02.153000             🧑  作者: Mango

代码示例1
myButton.addTarget(self, action: #selector(myButtonTapped), for: .touchUpInside)
@objc func myButtonTapped() {
    print("My button was tapped!")
}