How would you detect and run an action when a UIImageView
is touched?
This is the code that I have so far:
override func touchesBegan(touches:
You can put an UITapGestureRecognizer
inside your UIImageView
using Interface Builder or in code (as you want), I prefer the first. Then you can put an @IBAction
and handle the tap inside your UIImageView
, Don't forget to set the UserInteractionEnabled
to true
in Interface Builder or in code.
@IBAction func imageTapped(sender: AnyObject) {
println("Image Tapped.")
}
I hope this help you.