Swift 2.2具有使用
#selector语法编译时检查的选择器,请参阅https://swift.org/blog/swift-2-2-new-
features/以及将Swift与Cocoa和Objective-C一起使用(Swift
2.2)
对于您的示例,将以这种方式编写:
button.addTarget(self, selector: #selector(ViewController.buttonTapped(_:)),forControlEvents: .TouchUpInside)



