Uiimageview Add Tap Gesture Swift

[Solved] Uiimageview Add Tap Gesture Swift | Swift - Code Explorer | yomemimo.com
Question : uiimageview add tap gesture swift

Answered by : frail-flatworm-003mf5w9gyny

override func viewDidLoad()
{ super.viewDidLoad() let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(imageTapped(tapGestureRecognizer:))) imageView.isUserInteractionEnabled = true imageView.addGestureRecognizer(tapGestureRecognizer)
}
@objc func imageTapped(tapGestureRecognizer: UITapGestureRecognizer)
{ let tappedImage = tapGestureRecognizer.view as! UIImageView // Your action
}

Source : https://stackoverflow.com/questions/27880607/how-to-assign-an-action-for-uiimageview-object-in-swift | Last Update : Sun, 23 Feb 20

Answers related to uiimageview add tap gesture swift

Code Explorer Popular Question For Swift