I'm trying to capture the long touch on my image. So I can send an action to you in a long touch.
@IBOutlet weak var imageRecord: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
let longPressRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(addReconigzer(press:)))
longPressRecognizer.minimumPressDuration = 1.0
imageRecord.addGestureRecognizer(longPressRecognizer)
}
@objc func addReconigzer(press:UILongPressGestureRecognizer){
if press.state == .began
{
print("oi amigo")
}
}
But for some reason the "hi friend" is not printed on my console when I'm preloading the image for a certain time. Can someone tell me where I am wrong or what I should do to be able to have the action performed when I press my image for a long time?
I accept suggestions to be able to do otherwise, already tried to do with button but also not to get someone can help me?