Answer the question
In order to leave comments, you need to log in
How to get a variable stored in UiView?
Friends, tell me please.
I have a programmatically created UiView that holds a lot of items, topped by a transparent UiButtone layer that has a CGRect equal to it, to keep track of the user's selection... How can I know which copy of that UiView the user has touched? Inside, I placed the serial numbers assigned during creation, but somehow I can’t get them. I manage to catch exactly the button to which I touch, but the view data on which it is located is not. Or is it done in a completely different way? I would be very grateful.
Answer the question
In order to leave comments, you need to log in
To track the touch of the view, there is no need to hover over the button, add a gesturerecognizer directly on the view and track the touch directly. If you still need to use a subview as a button, then you can either try to get the superview for the button or iterate through all the views to determine which button is in the subview (not the best option - either get optionals or iterate over a large number of values).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question