【发布时间】:2020-08-25 15:07:22
【问题描述】:
我只能从 ViewController 创建我的 segue 函数,并且我的 TableViewCell 中必须有 longPress 函数。没有办法在不出错的情况下引用 segue 函数。当按钮保持在 TableView 单元中时,我将如何在 cellForRow 中实现此代码以继续?顺便说一句,我正在使用故事板。
@objc func longPress(gesture: UILongPressGestureRecognizer) {
if gesture.state == UIGestureRecognizer.State.began {
print("Long Press")
//performSegue(withIdentifier: "toProfile", sender: self)
}
}
func addLongPressGesture(){
let longPress = UILongPressGestureRecognizer(target: self, action: #selector(longPress(gesture:)))
longPress.minimumPressDuration = 0.75
self.expandButton.addGestureRecognizer(longPress)
【问题讨论】:
标签: ios swift uitableview button storyboard