-(void)tapDetected:(UIGestureRecognizer*)recognizer{
(UIImageView)(recognizer.view).tag)
;}
I want to convert type of recognizer’s view to imageview so that i can use tag of image as a reference. how can i do that?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
tagproperty is declared inUIView, notUIImageView. No cast is needed.For illustration purposes, this is how you would cast the view to
UIImageViewif you wanted, for example, access to itsimageproperty:For ease of use, you can use a local variable to make subsequent accesses cleaner: