如何在选择器中传递额外的参数?

时间:2016-04-22 09:54:19

标签: ios swift

我有这段代码

class func catchWeightList(catchWeightButton : UIButton, productCatchWeightList:NSArray){
    let window = UIApplication.sharedApplication().keyWindow
    let tap = UITapGestureRecognizer(target: self, action: Selector("handleTap:"))

    let catchWeightVC = CatchWeight.init(nibName: "CatchWeight", bundle: nil,dataSource: productCatchWeightList, catchWeightButton: catchWeightButton)

    if catchWeightVC.view.superview == nil {
        let y =  catchWeightButton.frame.origin.y+catchWeightButton.frame.height+64

        catchWeightVC.view.frame = CGRectMake(catchWeightButton.frame.origin.x, y ,catchWeightButton.frame.width, 90)

        window?.addSubview(catchWeightVC.view)
        window?.addGestureRecognizer(tap)
    }
    else{
        catchWeightVC.view.removeFromSuperview()
        window?.removeGestureRecognizer(tap)
    }


}
class func handleTap(sender: UITapGestureRecognizer? = nil) {
    //        catchWeightVC?.view.removeFromSuperview()
    let window = UIApplication.sharedApplication().keyWindow
    window?.removeGestureRecognizer(sender!)
}

如何在handleTap中传递catchWeightVC?

0 个答案:

没有答案