美文网首页
swift UIButton的点击使用

swift UIButton的点击使用

作者: HitlerCoding | 来源:发表于2019-01-24 11:20 被阅读8次

addTarget的使用
带参数的方法
btn.addTarget(self, action:#selector(tapped(:)), for:.touchUpInside)
// func tapped(
button:UIButton) {
// print("wilson")
// }

不带参数的方法
btn.addTarget(self, action: #selector(tapped), for: UIControlEvents.touchUpInside)
func tapped() {
}

相关文章

网友评论

      本文标题:swift UIButton的点击使用

      本文链接:https://www.haomeiwen.com/subject/gqdyjqtx.html