-1
I’m trying to capture the long tap on my image. So I can send an action to 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 it is not printed in my console the "hi friend" when I am pricing the image for a certain time. Can anyone tell me where I’m wrong or what I should do so I can have the action executed when I press for a long time my image?
I accept suggestions to be able to do otherwise, already tried to do with button but also not getting someone can help me ?