swift3 selector傳遞參數(shù)問題
var index = 12
?let pan = #selector(self.delimg( index : ) )?
let guest = UITapGestureRecognizer(target: self, action: pan)
func delimg(index : Int){ print("(index)") }
這樣為什么拿不到參數(shù) 需要怎么操作
var index = 12
?let pan = #selector(self.delimg( index : ) )?
let guest = UITapGestureRecognizer(target: self, action: pan)
func delimg(index : Int){ print("(index)") }
這樣為什么拿不到參數(shù) 需要怎么操作
2016-11-04
舉報(bào)
2016-11-08
你傳的函數(shù)相當(dāng)于一個代理時間,他給你傳的參數(shù)應(yīng)該是?UITapGestureRecognizer對象,就像UIButton的點(diǎn)擊事件一樣。?
func delimg(index : UITapGestureRecognizer){}