Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

cannot assign IBaction to uiimageview

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
}
Comment

PREVIOUS NEXT
Code Example
Swift :: swift 5 btn change image 
Swift :: swift for loop index 
Swift :: xcode hide keyboard when touch background storyboard 
Swift :: swift uicollectionviewcell how to know when off screen 
Swift :: swift quit app 
Swift :: Change BackgroundColor of Picker ios swift 
Swift :: cross origin requests are only supported for http wkwebview 
Swift :: how to select but not focus textfield swift 
Swift :: swift check dictionary has key 
Swift :: fizzbuzz in swift 
Swift :: UICollectionView current visible cell index 
Swift :: swift http request header 
Swift :: swift remove all duplicates from an array 
Swift :: swiftui foreach 
Swift :: get keyboard height swift 
Swift :: disable swipe to delete swift 
Swift :: react native ios rtl 
Swift :: NumberFormatter swift 
Swift :: Swift Basic Input 
Swift :: enviroment dissmiss swiftui 
Swift :: add shadow to specific corner of UIView with shadow swift 6 site:stackoverflow.com 
Swift :: if else if and else statments in swift language 
Swift :: swift remove all pins from mapkit 
Swift :: swift while loop 
Swift :: enum in swift 
Swift :: swiftui image aspect ratio 
Swift :: Swift Objects 
Swift :: Swift Print Variables and Literals 
Swift :: int in swift 
Swift :: Swift Create enum variables 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =