发送参数以点击UITap动作:Swift

时间:2015-08-27 01:29:39

标签: swift arguments uitapgesturerecognizer

我想向UITapGestureRecognizer发送参数。我想将一个didRepond(Bool)发送到" tapRespond"功能。但是,我不知道该怎么做。你能告诉我怎么做吗?如果我不应该使用UITapGestureRecognizer,请 告诉我另一种方式。谢谢你的好意。

didRespond = true
cell.respond.tag = indexPath.row //cell.respond is UILabel 
cell.respond.addGestureRecognizer(UITapGestureRecognizer(target:self,action:"tapRespond:"))

//我更新如下。在UITapGestureRecognizer之外,我切换了这个功能。

didRespond = true
cell.respond.tag = indexPath.row //cell.respond is UILabel ]

if didRespond == false {
    cell.respond.addGestureRecognizer(UITapGestureRecognizer(target:self,action:"willRespond:"))
} else {
    cell.respond.addGestureRecognizer(UITapGestureRecognizer(target:self,action:"didRespond:"))
}

0 个答案:

没有答案