我在Swift 3中搜索了很多选择器方法,但我对它有很多困惑。swift 3选择器与参数
1)Selector
& #selector
有什么区别?
2)如果我用Selector
写的,这个函数概述意味着不可用?
3)如何通过#selector
方法传递参数。
我的代码
let button = UIButton()
button.addTarget(self, action: #selector(getData(_:true)), for: .touchUpInside)
button.addTarget(self, action: Selector(), for: .touchUpInside)
func getData(_ isShowing:Bool){
}
你能不能帮我清除我的困惑?
感谢您的宝贵时间
与这一个http://stackoverflow.com/questions/41520683/swift-3-unrecognized-selector-sent-to-instance-uibutton –
关于质询3.比较只需使用'#selector( getData)'不需要指定参数。 –
@LeoDabus,谢谢你的回答,但我必须通过一个值检查条件。 – user1673099