get index or tag value from imageview tap gesture

后端 未结 6 537
情深已故
情深已故 2020-12-09 11:04

\"enter

This is the image from app store whenever we search for any app. I also want t

6条回答
  •  暖寄归人
    2020-12-09 11:42

    Suppose you have an array with the objects to display and a UIImageView to display the image, just do this when setting up the view with the index i:

    imageView.tag = kImageTag + i; 
    

    where kImageTag is any constant > 1 to make sure you don't get a 0 as the tag.

    Now when the view is selected you can simply check for the tag of the image view.

提交回复
热议问题