Add a selector to a button in UIScrollView views added dynamically

I have a UIScrollView with n views dynamically added from metadata stored in an archive. I have a PressGesture to make a wobble animation (e.g. a way to remove iOS apps), and I want to add a button for each subset in ScrollView to remove it from ScrollView and from files.

My problem is to add a target to the buttons. When they are clicked, the selector (in the parent element of the UIViewController for the UIScrollView) is not called.

How can i do this? Any other approach proposed?

Thanks in advance.

-2
source share
1 answer

When you animate a view, it stops responding to user input. And if your button is inside an animated view, this will definitely not trigger a selector.

The solution is to wrap your swinging look in a transparent supervisor, and then place the Delete button inside that supervisor. If you want your button to also be β€œrocker”, you need to place an image representing the button inside your rocker view. And inside the cover set a transparent user button that will actually respond to the user's click.

+1
source

All Articles