gpt4 book ai didi

ios - UILongPressGestureRecognizer : action method not being called

转载 作者:行者123 更新时间:2023-11-30 13:44:55 25 4
gpt4 key购买 nike

当用户长按触摸时,我尝试向 map 添加注释。我已经实现了如图所示的代码,但由于某种原因,操作方法(我找不到!:()没有被调用。我检查了几个地方,似乎已经完成仅此方式。如果有人能告诉我哪里做错了,那就太好了。

当前应用程序正在终止并给出 NSInvalidArgumentException。

提前感谢您的帮助! :)

Code Image

最佳答案

您需要更改此行:

let recognizer =  UILongPressGestureRecognizer(target: mapController, action: "action:")

let recognizer =  UILongPressGestureRecognizer(target: self, action: "action:")

它会起作用的。因为您的方法位于 self (注释类)本身中。

关于ios - UILongPressGestureRecognizer : action method not being called,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35081358/

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