UIGestureRecognizer is not working, even though i enable isUserInteractionEnabled

90 Views Asked by At
 lazy var profileImageView: UIImageView = {
    let imageView = UIImageView()
    imageView.translatesAutoresizingMaskIntoConstraints = false
    imageView.image = UIImage(named: "1")
    imageView.contentMode = .scaleAspectFill

    imageView.isUserInteractionEnabled = true
    imageView.addGestureRecognizer(UIGestureRecognizer(target: self, action: #selector(handleSelectedProfileImage)))

    return imageView
}()

@objc func handleSelectedProfileImage() {
    print("fff")
}

I follow the instruction on Youtube to set the action for uiimageView, but it can not print anything from the function, do not know what happen

0

There are 0 best solutions below