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