gpt4 book ai didi

ios - uigesturerecognizer 双击 tableviewcell + segue swift

转载 作者:行者123 更新时间:2023-11-29 01:16:03 25 4
gpt4 key购买 nike

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {

    if segue.identifier == "editinfo"{

let selecteditem: NSManagedObject = items[self.tableView.indexPathForSelectedRow!.row] as! NSManagedObject

let viewcon: addViewController = segue.destinationViewController as! addViewController

viewcon.usernameupdate = selecteditem.valueForKey("username") as! String
viewcon.emailupdate = selecteditem.valueForKey("email") as! String

viewcon.existeditem = selecteditem

}

我尝试了以下但总是在单击时触发 segue

let doubleTap = UITapGestureRecognizer(target: self, action: nil)
doubleTap.numberOfTapsRequired = 2
doubleTap.numberOfTouchesRequired = 1
cell.addGestureRecognizer(doubleTap)

最佳答案

检查我的双击代码,非常简单。

您可以放入一个示例项目进行调试,也许其他东西会阻止您的代码正常工作。

override func viewDidLoad() {
super.viewDidLoad()

let doubleTap = UITapGestureRecognizer(target: self, action: "doubleTapHandler")
doubleTap.numberOfTapsRequired = 2
view.addGestureRecognizer(doubleTap)
}

func doubleTapHandler() {
print("double tap")
}

关于ios - uigesturerecognizer 双击 tableviewcell + segue swift,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35165450/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com