【发布时间】:2015-09-29 12:19:21
【问题描述】:
为什么这不起作用:
self.backButton?.addTarget(self, action: Selector("backButtonPressed:"), forControlEvents: .TouchUpInside)
// unrecognized selector sent to instance CRASH
func backButtonPressed(sender:AnyObject?) {
}
此崩溃到(发送到实例的无法识别的选择器)
func backButtonPressed(sender:UIButton) {
}
【问题讨论】:
-
实际为我工作,无需任何修改。
-
我尝试了这两个功能,但它们都崩溃了。消息:-[MyApp.HeaderView backButtonPressed:]: unrecognized selector sent to instance 0x7f9bd8432c70