为什么UITapGestureRecognizer会在函数调用中粘贴参数时发送到选择器的函数参数?
blackView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(handleDismiss)))
func handleDismiss(setting: Setting){
UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 1, options: .curveEaseOut, animations: {
self.blackView.alpha = 0
if let window = UIApplication.shared.keyWindow {
self.collectionView.frame = CGRect(x:0,y: window.frame.height, width: self.collectionView.frame.width, height: self.collectionView.frame.height)
}
}, completion: {
(completed: Bool) in
if setting.name != "" && setting.name != "Cancel" {
self.homeController?.showControllerForSetting(setting: setting)
}
})
}
所以当我点击视图时它会调用这个函数,但是函数调用中没有粘贴实际参数,所以gesturerecognizer发送到参数intself https://drive.google.com/open?id=0Bz964D-WrU9KT1RDenFGbktLVEE这里是调试图片。